Ecere SDK/eC Forums • View topic - eC Grammar




Ecere SDK/eC Forums

Ecere Developers Community

eC Grammar

General help with the eC language.

eC Grammar

Postby cloutiy » Sat Jul 15, 2017 11:36 am

Jerome,

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.

Regards
cloutiy
 
Posts: 18
Joined: Wed Jul 20, 2016 5:07 pm

Re: eC Grammar

Postby jerome » Sat Jul 15, 2017 12:17 pm

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: http://ec-lang.org/eC-grammar.txt
There's also the Bison description file, but it's polluted with error handling rules and makes it hard to read:
https://github.com/ecere/ecere-sdk/blob ... /grammar.y
And the accompanying flex:
https://github.com/ecere/ecere-sdk/blob ... rc/lexer.l
Alternatively, there's the new code parsing recursive-descent style (still work in progress):
https://github.com/ecere/ecere-sdk/tree ... 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!

Cheers,

-Jerome
jerome
Site Admin
 
Posts: 614
Joined: Sat Jan 16, 2010 11:16 pm

Re: eC Grammar

Postby cloutiy » Sat Jul 15, 2017 12:36 pm

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.
cloutiy
 
Posts: 18
Joined: Wed Jul 20, 2016 5:07 pm

Re: eC Grammar

Postby jerome » Sat Jul 15, 2017 6:01 pm

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.

-Jerome
jerome
Site Admin
 
Posts: 614
Joined: Sat Jan 16, 2010 11:16 pm


Return to eC Language

Who is online

Users browsing this forum: No registered users and 1 guest

cron