Goldie: Sample Generic Parse
Parsing System (v0.9)
Goldie Home (v0.9) -> GoldieLib Sample Apps -> Sample Generic Parse

Sample Generic Parse

Parses any source file according to any compiled grammar and displays basic information about both the language and the parsed source.

Try using the included lang/calc.cgt language on the included *.calc files. Or use your own grammar and source.

Sample Generic Parse Source Code

Sample run:

>cat lang/valid_sample2.calc 4*4*3 /4 - ( 10 + 0 ) * -100 >goldie-sampleGenericParse lang/valid_sample2.calc lang/calc.cgt Grammar Info: File: lang/calc.cgt Name: Calc Version: 0.01 Author: Nick Sabalausky About: Basic Calculator Grammar Root of parse tree: type: NonTerminal name: <Add Exp> First terminal in parse tree: type: Terminal name: Number content: '4' line: 1 Last terminal in parse tree: type: Terminal name: Number content: '100' line: 4 Root of parse tree has 3 child node(s): Node index 0 is a NonTerminal '<Add Exp>' with 1 child node(s) and content '4*4*3/4' and raw content: 4*4*3 /4 Node index 1 is a Terminal '-' Node index 2 is a NonTerminal '<Mult Exp>' with 3 child node(s) and content '(10+0)*-100' and raw content: ( 10 + 0 ) * -100