genmk and makefiles:

genmk takes one or more grammar description filenames as arguments, and writes the contents of a makefile which would build the program described in these files to stdout.

Makefiles and PCCTS

PCCTS grammar description files usually end with a ".g" extension and contain information to build a lexer and a parser. Different parts of this file must be interpreted by different utilities to build the lexing and parsing functions. genmk generates the contents of a makefile for a PCCTS-base project that will coordinate the effort of these utilities. This information is written to stdout and must be redirected into a makefile (or somehow piped into "make") to be used.

Options to genmk

The following options are defined for genmk, and are given as command-line switches:
-CC
Generate C++ output (as opposed to C output in PCCTS-1.*).
-class gclass
gclassis the name of a grammar class defined in the grammar (if C++)
-dlg-class dclass
dclassis the name of a DLG lexer (if C++). The default is DLGLexer.
-header filename
filename is the name of the ANTLR standard header information file. The default is no file.
-o directory
directory is the name of the directory to which output files should be written. The default is ".".
-project filename
filename is the name of the executable file to create. The default is "t".
-token-types filename
Use file filename to define token types rather than tokens.h.
-trees
Generate abstract syntax trees (ASTs).
-user-lexer
Do not create a DLG-based scanner.

Note to EE468 Students

Most of you will be using PCCTS to generate a C-based compiler from a single PCCTS grammar description file. You will likely be given a particular name for the executable file that should be built when the grader (or a shell script) executes "make" from your working directory. To do this you will only need to use the "-project" option to genmk to have the makefile build the proper executable when "make" is executed.

Thus, you will typically use genmk as follows:


	genmk -project executable grammar.g > makefile
where executable is replaced by the name of the executable you want built, and grammar.g replaced by the name of the grammar description file which contains your project's PCCTS source.
This page was last modified .