peg icon indicating copy to clipboard operation
peg copied to clipboard

PEG files for peg in examples fails to compile

Open greenfork opened this issue 1 year ago • 4 comments

> ./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.

greenfork avatar Dec 24 '23 15:12 greenfork

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 avatar Dec 24 '23 16:12 SeanTAllen

The two different bugs should be addressed in different PRs.

SeanTAllen avatar Dec 24 '23 16:12 SeanTAllen

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 avatar Dec 24 '23 16:12 SeanTAllen

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

SeanTAllen avatar Dec 25 '23 01:12 SeanTAllen