Parsing System (v0.9)
|
Grammar Definition LanguageGoldie uses the same GOLD Meta-Language grammar definition language as GOLD Parser Builder. GOLD Parser Builder includes a grammar editor that features syntax highlighting, a grammar-generating wizard, and importing/exporting with YACC/Bison format. Goldie's calc.grm grammar below was created by using GOLD's grammar wizard (and slightly modifying the result). Other premade grammars can be found in GOLD's downloads section. SampleAs a simple example of what a grammar looks like, this is the calc.grm grammar included with Goldie and used by the Sample Apps: ! -- Parameters ----------------------------------------
! Basic Calculator Grammar
! Supports integer literals, + - * / () and whitespace
"Name" = 'Calc'
"Author" = 'GOLD Parser Builder and Nick Sabalausky'
"Version" = '0.01'
"About" = 'Basic Calculator Grammar'
"Case Sensitive" = false
"Start Symbol" = <Add Exp>
! -- Terminals -----------------------------------------
Number = {Digit}+
Whitespace = {Whitespace}+
! -- Rules ---------------------------------------------
<Add Exp> ::= <Add Exp> '+' <Mult Exp>
| <Add Exp> '-' <Mult Exp>
| <Mult Exp>
<Mult Exp> ::= <Mult Exp> '*' <Negate Exp>
| <Mult Exp> '/' <Negate Exp>
| <Negate Exp>
<Negate Exp> ::= '-' <Value>
| <Value>
<Value> ::= 'Number'
| '(' <Add Exp> ')'
Current LimitationsThere are a few GOLD features that Goldie doesn't yet support:
See Also: |