B.1 The Template File - UNFUG Expression Evaluation



next up previous contents
Next: B.2 The UNFUG Syntax Up: PhD Thesis Franz Fasching Previous: B UNFUG Reference

B.1 The Template File - UNFUG Expression Evaluation

 

UNFUG template source files are regular source files of the respective target programming language with special UNFUG expressions inserted in angle brackets <>. Angle brackets were chosen since they resemble the notations for ``placeholders'', but they may conflict with the genuine usage of angle brackets in a programming language syntax (mostly as relational operators). To overcome this situation, some precautions are taken to avoid syntactical conflicts.

Two forms of an UNFUG expression are possible: A simple LISP variable name, e.g. <variable_name>, or a full LISP expression, e.g. <(strcat "int " variable_name)>. In both forms, no spaces are allowed immediately after the opening or before the closing angle bracket of the expression to be properly recognized by UNFUG. In the first case, the variable name may just contain upper- or lowercase letters, numbers or an underscore character ``_'', thus avoiding any conflicts with typical conditional constructs in most programming languages, where 1<variable_name would be an invalid expression syntax. In the second case, the same holds true if the variable is substituted with a parenthesized expression (with, of course, matching parentheses). Thus it is guaranteed that no UNFUG expression may conflict with a syntactically correct programming language construct of common programming languages like C, FORTRAN, or PASCAL.

When running UNFUG on a template file, UNFUG appends all lines which do not contain a valid UNFUG expression unmodified to the output file. When encountering a valid UNFUG expression in a template source file, the UNFUG expression evaluator now pursues the following strategy:

The LISP expression is taken ``as is'' and is just evaluated by the LISP interpreter. Any syntactical or semantical errors are therefore not detected by UNFUG, but only by XLISP upon evaluation. This may be considered a drawback, but it offers the utmost flexibility in code generation, however complex this process may be. A few LISP functions are predefined by UNFUG, which perform the actual tasks UNFUG was developed for. These are described in the following section.



next up previous contents
Next: B.2 The UNFUG Syntax Up: PhD Thesis Franz Fasching Previous: B UNFUG Reference



Martin Stiftinger
Tue Nov 29 19:41:50 MET 1994