A Pedagogically Significant Approach to Inputting Mathematical Expressions at Runtime in C
V. N. Krishnachandran, Jisha Jose Panackal · 2011
problem of inputting a mathematical expression at runtime in C is generally considered very difficult. The general approach to solve the problem is to include specialized parser packages as header files. It appears that such packages are available only for advanced versions of C like C++ or C#. In this paper we consider a very elementary solution to the problem which does not make use of external packages and uses only the basic concepts of the C programming environment. It also does not require the in-line implementation of the extremely difficult task of parsing a mathematical expression. This approach is accessible to beginning programmers also. In broad outline, the approach adopted is that while a programme is being executed, it generates another programme, compiles and executes the new programme, and finally returns to the original programme. Even though the method may not be satisfactory in terms of speed or efficiency, it is pedagogically significant as it can be employed as a tool for throwing more light on the basic concepts of compilation and execution of a programme.