Pointers to examples

57 views
Skip to first unread message

duox...@gmail.com

unread,
Aug 30, 2017, 9:32:26 AM8/30/17
to marpa parser
Dear all,

I was looking for examples that handled the following scenarios that occur often:

1. How to reject a keyword as an identifier if both can be lexed at a given place? (Often keywords and identifiers overlap but many languages do not allow keywords as identifiers.)

2. How to obtain the ambiguous parses in a forest? How to traverse a parse forest?

If anybody can point me to examples other than for PEG that would be very much appreciated.

At a broader note, it would be great if we could assemble a small repository of such examples. I think it would make marpa much more accessible if we had examples of often needed solutions readily accessible. Right now, we just have some large language examples (too big to get started) and many small examples spread all over (too difficult to find).

Ron Savage

unread,
Sep 7, 2017, 7:04:35 PM9/7/17
to marpa parser, duox...@gmail.com
Hi

You did not specify a preferred language, but if you're comfortable with Perl, see GraphViz2::Marpa on my Marpa homepage: http://savage.net.au/Marpa.html. In particular, the method _validate_event() shows how to handle the case of 2 lexeme-driven events triggered at the same time.

The following modules also use validate_event()-style processing:
o MarpaX::Languages::Dash
o MarpaX::Languages::Perl::PackUnpack
o Regexp::Parsertron
o Text::Balanced::Marpa
o Text::Delimited::Marpa

Reply all
Reply to author
Forward
0 new messages