Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Buildtools

The buildtools directory is a small compiler-compiler using an LL1 grammar description as input. Currently, the grammar description of the QQCS system is the file z-qdesk.txt. In this file, the first section is the grammar description using a simple unrestrictive syntax. LL1 syntax is right-recursive and allows the empty string in productions. An empty string production has an empty right-hand side. There is no alternate production syntax. If a non-terminal has alternate, the non-terminal is given another production on the next line. Anything in the right-hand of a production that does not have a left-hand definition is a terminal. There should be only one non-terminal that does not appear in a product, and is assumed to be the root symbol. A # begins a comment line.

The second section begins with the comment # Terminal-mapping and contain one line per grammar terminal that maps the terminal to a name that can be used as a syntactically valid name to identify the symbol in the generated code. The section ends with the comment # end-mapping.

The third section controls the generated code and consists of identifier comments and code comments. The identifier comments are of the form #@non-terminal-suffix. The non-terminal identifies the production with which the following code is associated, and the suffix indicates the point in the code where following code is to be placed. The # is stripped from the code lines and the lines are added to the generated code. It is necessary to examine the generated code template in order to determine the correct suffix for code placement within the generated output.

The Java class CodeGen.java generates a Javascript compiler template and is the only language currently generated by the compiler-compiler. The class should be the target for modifications to the generated compiler template code.