Re: strict productions
Bastiaan Veelo <[email protected]> Wed, 1 Mar 2017 21:52:09 +0100
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Message-ID | <[email protected]> |
Just a follow-up. I have since added a longest match alternator to Pegged, and it now successfully parses all Extended Pascal source that I have tried (with few Prospero extensions). It is too slow though to be the basis for a compiler; at this point. Let me know if anyone here wants to try, I can provide binaries. (The source is there of course, see below). Bastiaan. > On 18 Feb 2017, at 11:37, Bastiaan Veelo <[email protected]> wrote: > > The parser is online now as an example of Pegged: > > https://github.com/PhilippeSigaud/Pegged/tree/master/pegged/examples/extended_pascal > > However, the "ordered choice” parsing in PEG is not a good solution to deal with the ambiguities in the Extended Pascal grammar. When I threw one of my Pascal sources at it, it just failed to parse. I will see if implementing a “longest match choice” makes a difference. > https://github.com/PhilippeSigaud/Pegged/issues/218 > > Note that this project is not meant to be part of a robust traditional compiler. My interests are in transcompiling, and therefore I am not concerned with the quality of error messages or performance. Also, as I understand it, the gpc frontend already parses almost all of EP, so I am not at all sure that writing a new parser is worth while. But for me it is a nice subject to get acquainted with D and experience its powers. > > Bastiaan. > >> On 16 Feb 2017, at 09:59, Bastiaan Veelo <[email protected]> wrote: >> >> The parser is complete except the handling of ambiguities. But it is just that: a parser. The output is an AST. >> >> I have meant to submit the grammar as an example to Pegged [1], I’ll see if I can find some time for that, together with an example parser. >> >> Bastiaan. >> >> [1] https://github.com/PhilippeSigaud/Pegged >> >>> On 15 Feb 2017, at 21:20, John L. Ries <[email protected]> wrote: >>> >>> I'm not at all sure we really want a trilingual compiler, but the parser >>> is complete or nearly so, it's probably worth a look. >>> >>> --------------------------| >>> John L. Ries | >>> Salford Systems | >>> Phone: (619)543-8880 x107 | >>> or (435)867-8885 | >>> --------------------------| >>> >>> >>> On Wed, 15 Feb 2017, Bastiaan Veelo wrote: >>> >>>> I wrote a recursive descent parser for Extended Pascal in the D language >>>> using the Pegged library, which takes the rules of the standard almost >>>> literally. I remember changing the order of options in some rules, but I am >>>> unsure whether that was for efficiency or for giving precedence to common >>>> constructs. I do remember seeing ambiguities in variable access and function >>>> access, which I imagine can be resolved by keeping a symbol table of earlier >>>> definitions. >>>> >>>> My parser is an interesting project but turned out to be rather inefficient >>>> at the moment. If there is an interest I will consider to put it online. >>>> >>>> Bastiaan. >>>> >> >> _______________________________________________ >> Gpc mailing list >> [email protected] >> https://www.g-n-u.de/mailman/listinfo/gpc > > > _______________________________________________ > Gpc mailing list > [email protected] > https://www.g-n-u.de/mailman/listinfo/gpc _______________________________________________ Gpc mailing list [email protected] https://www.g-n-u.de/mailman/listinfo/gpc