ponylang / peg

:horse: A parsing expression grammar package for Pony
BSD 2-Clause "Simplified" License
16 stars 6 forks source link

PEG files for peg in examples fails to compile #43

Open greenfork opened 10 months ago

greenfork commented 10 months ago
> ./build/release/compiler examples/pony.peg peg/ast.pony
-- Syntax Error --

/home/grfork/playground/pony/aoc2023/day02/_corral/github_com_ponylang_peg/examples/pony.peg:35:5:1

35:     '=>' seq '}' cap?
        ^
        expected end-of-file

There is a syntax error that has prevented the parser from being able to
understand the source text.
> ./build/release/compiler examples/peg.peg examples/json.peg
-- Syntax Error --

/home/grfork/playground/pony/aoc2023/day02/_corral/github_com_ponylang_peg/examples/json.peg:19:16:1

19: object <- -'{' (pair % ',') -'}'
                   ^
                   expected end-of-file

There is a syntax error that has prevented the parser from being able to
understand the source text.
SeanTAllen commented 10 months ago

When running with individual files like:

../build/release/compiler peg.peg

then peg.peg and json.peg work fine, but the pony.peg does have an issue.

When giving two args like is done in the examples in the report. It would create a compiler from the using the first one of the two peg files and run over the second.

So there's at least a couple bugs to look for in the examples. One.

../build/release/compiler pony.peg

where the pony.peg isn't valid.

And

../build/release/compiler peg.peg json.peg

where the parser created by peg.peg doesn't understand json.peg. the bug there would probably be peg.peg not validating json.peg. IE the bug is probably in peg.peg. Because json.peg is valid, just not when peg.peg parses it.

SeanTAllen commented 10 months ago

The two different bugs should be addressed in different PRs.

SeanTAllen commented 10 months ago

I have a fix for the pony.peg issue. But it exposes a larger issue that the pony.peg is out of date and missing rules. I opened #45 for that new much larger issue.

SeanTAllen commented 10 months ago

the grammar in peg.peg should be updated to be the same as the grammar in peg/pegparser.pony.