Closed nkeronkow closed 10 years ago
In your grammar you have:
type Lojban Peg { *Tree }
you probably don't want the '*Tree' which is for a PEG syntax tree.
An example of how to produce an AST can be found in main.go line 63.
On Fri, Sep 26, 2014 at 4:36 AM, nkeronkow notifications@github.com wrote:
I'm trying to create a parser from the PEG grammar for the lojban language. The grammar and the outputed parser are here https://github.com/pointlander/peg/issues/gist.github.com/nkeronkow/0a1f41eb3820cfc2bc2c
After tweaking the outputted parser to correct the problem described in this issue https://github.com/pointlander/peg/issues/30, I encounter several errors like this on multiple lines:
./lojban.peg.go:22924: non-integer array index rules
...as well as this:
./lojban.peg.go:24115: cannot use rules (type [882]func() bool) as type pegRule in function argument
If I understand what's going on correctly, the parser generator prefixes rule to the front of the name of every rule defined in the grammar to create its list of enums. lojban.peg creates a rule for every letter in the lojban alphabet, which includes the letter 's', so the rule in the parser is named rules. This conflicts with a variable in the parser by the same name which is defined as an array of func() bool.
— Reply to this email directly or view it on GitHub https://github.com/pointlander/peg/issues/31.
I'm trying to create a parser from the PEG grammar for the lojban language. The grammar and the outputed parser are here
After tweaking the outputted parser to correct the problem described in this issue, I encounter several errors like this on multiple lines:
...as well as this:
If I understand what's going on correctly, the parser generator prefixes
rule
to the front of the name of every rule defined in the grammar to create its list of enums. lojban.peg creates a rule for every letter in the lojban alphabet, which includes the letter 's', so the rule in the parser is namedrules
. This conflicts with a variable in the parser by the same name which is defined as an array offunc() bool
.