Page 1 of 1

eC Grammar

PostPosted: Sat Jul 15, 2017 11:36 am
by cloutiy

Would the eC language grammar be documented somewhere?

I know I've been MIA for a while, but have been keeping busy reading about compilers, compiler design, trying different things with scanning and parsing etc...

If there is a formal description of the language I would be interested in having a look.


Re: eC Grammar

PostPosted: Sat Jul 15, 2017 12:17 pm
by jerome
Hi Yves,

We have not managed to put together a formal description of the language, unfortunately.
That's something we would really like to do though.

This can serve as a summary:
There's also the Bison description file, but it's polluted with error handling rules and makes it hard to read: ... /grammar.y
And the accompanying flex: ... rc/lexer.l
Alternatively, there's the new code parsing recursive-descent style (still work in progress): ... libec2/src

If you had some time and interest to help with formalizing the grammar or improving the new parser (libec2) that would be beyond awesome!



Re: eC Grammar

PostPosted: Sat Jul 15, 2017 12:36 pm
by cloutiy
Thanks Jerome.

Yes, I would be interested in formalizing the grammar.

This would be a good first step, otherwise it makes it a bit difficult to work on the parser

I can start on the grammar and submit it for review once it's in decent shape.

Re: eC Grammar

PostPosted: Sat Jul 15, 2017 6:01 pm
by jerome
That would be awesome!

The grammar is really all defined in the Bison grammar.y, but like I said a formal version of it would do away with all extra rules for error recovery (error recovery is much easier to do in the handwritten RD parser).

Some aspects of the grammar etc. would be up to review / improve, but it would be nice to have an authoritative formal description of how things actually work in the compiler right now, with clarifications of future improvements etc. We should get together at your convenience and discuss this if you want to get started on this.