Goldie v0.4
Goldie v0.4 Home -> GoldieLib Sample Apps -> Parse Anything

Parse Anything

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

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

Parse Anything Source Code

Sample run:

>cat lang/valid_sample2.calc 4*4*3 /4 - ( 10 + 0 ) * -100 >goldie-parseAnything 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