JavaCup

Description

Invokes the CUP Parser Generator for Java on a grammar file.

This task only invokes JavaCUP if the grammar file is newer than the generated Java files.

Parameters

Attribute Description Required
input The name of the file from which to read the JavaCUP specification. Yes
srcdir The name of the root folder of the java class hierarchy. Default is the current folder. No
package The name of the package generated classes go in. If not specified, this is deduced from the path of input, relative to srcdir. No
parserClass The full name of the parser class. If not specified, the class is derived from the input file: for example, if input is "src/com/foo/MyParser.cup", and srcdir is "src", the class will be "com.foo.MyParser". No
symbolsClass The name of the class which holds the symbols constants. If not specified, this is the parser class name with "Sym" appended, for example "com.foo.MyParserSym". No
interface If true, emit the symbol constant interface, rather than class. No
nonterms If true, put non-terminals in symbol constant class. No
expect Number of conflicts expected/allowed. Default is 0. No
compactRed If true, compact tables by defaulting to most frequent reduce. No
warn If true, warn about useless productions, etc. Default is true. No
summary If true, print a summary of parser states, etc. Default is true. No
progress If true, print messages to indicate progress of the system. Default is false. No
time If true, print time usage summary. No
dumpGrammar If true, produce a dump of the symbols and grammar. Default is false. No
dumpStates If true, produce a dump of the parse state machine. Default is false. No
dumpTables If true, produce a dump of the parse tables. Default is false. No
dump If true, switch on dumpGrammar, dumpStates, and dumpTables. Default is false. No
debug If true, turn on debugging messages within JavaCUP. Default is false. No
positions If true, generate positions code. Default is true. No
scanner If false, don't refer to java_cup.runtime.Scanner in the parser (for compatibility with old runtimes). Default is true. No
version If true, print version information for JavaCUP and halt. No

Example

<javacup
    input="src/com/foo/Parser.cup"
    warn="false"
    summary="false"/>

This invokes JavaCUP on grammar file src/com/foo/Parser.cup, generating src/com/foo/Parser.java and src/com/foo/ParserSym.java.