Class Main
java.lang.Object
Main
Main class to run the parser for YaLCC.
Read a source file, parse it, and print leftmost derivation rule numbers.
Additionally, can output LaTeX representation if specified.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classHelper class to parse command line arguments. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMain method to run the parser.private static ParseTreeParses the input file and returns the parse tree.private static voidprintRuleNumbers(ParseTree node) Recursively prints the rule numbers in leftmost derivation order.private static voidwriteLaTeXToFile(ParseTree tree, String latexFile) Writes the LaTeX representation of the parse tree to a file.
-
Constructor Details
-
Main
public Main()
-
-
Method Details
-
main
Main method to run the parser.- Parameters:
args- command line arguments; expects source file and optional -wt for LaTeX output
-
writeLaTeXToFile
Writes the LaTeX representation of the parse tree to a file.- Parameters:
tree- the parse treelatexFile- the output LaTeX file
-
parseFile
Parses the input file and returns the parse tree.- Parameters:
filename- the source file to parse- Returns:
- the resulting parse tree
-
printRuleNumbers
Recursively prints the rule numbers in leftmost derivation order.- Parameters:
node- the current parse tree node
-