Re: strict productions

Bastiaan Veelo <[email protected]> Sat, 18 Feb 2017 11:37:45 +0100
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
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