Note that aiSOFT files expect to make use of the 'sapini.wrk' script package. Build usable source code Usually, the basic underlying objective with respect to processing aiSOFT source code is to convert the input program, now represented as a data structure, into appropriate lex, yacc and C action structures for output. First, various transformations must be performed. Optimizations and conversion to C Remember, whenever a pattern is 'interpreted', runtime efficiency is lost. And, within the context of aiSOFT, the goal is to generate the tightest C obtainable, or at least, the tightest derivable source based on the supplied information.
Various optimizations are necessary.
Assume the existence of a function 'cvt1' which converts a 'bnf' structure to another intermediate, 'bnf' construction. It is this intermediate 'bnf' construction which is subsequently converted to a yacc representation by the 'cvt2' function. The 'cvt3' function, finally, converts the 'bnf' function to source. By the way, the first stage of aiSOFT is an ordinary C pre-processor. What follows is a cute little function which was originally written as part of a major Fortran conversion project.