Parser generator for Marpa

33 views
Skip to first unread message

Peter Stuifzand

unread,
Mar 16, 2012, 10:36:50 AM3/16/12
to marpa-...@googlegroups.com
Hi all,

I just 'released' the latest code for the Marpa parser generator to
GitHub. Similar to a combination of lex and yacc.

https://github.com/pstuifzand/Marpa-parser-generator/

It contains a description of a parser in a BNF, which can be
transformed into a program that parses such a description. It's all
very meta. Take a look at a description to get an idea of what it is.

https://github.com/pstuifzand/Marpa-parser-generator/blob/master/marpa.mp

Each line can also contains a 'rule' description and a piece of Perl
code. It looks like a BNF, but it's actually more like a configuration
language for Marpa::XS, a lexer and a code generator.

This is very much a work in progress. I welcome feedback.

--
Peter Stuifzand

Michael Alan Dorman

unread,
Mar 16, 2012, 10:46:09 AM3/16/12
to marpa-...@googlegroups.com
Peter Stuifzand <peter.s...@gmail.com> writes:
> I just 'released' the latest code for the Marpa parser generator to
> GitHub. Similar to a combination of lex and yacc.
>
> https://github.com/pstuifzand/Marpa-parser-generator/

I think Jefferey is asking that non-core Marpa projects place themselves
in a MarpaX namespace.

Mike.

Peter Stuifzand

unread,
Mar 16, 2012, 10:50:32 AM3/16/12
to marpa-...@googlegroups.com
As far as I know I don't do that. And it's not my intention.

--
Peter

Michael Alan Dorman

unread,
Mar 16, 2012, 10:58:40 AM3/16/12
to marpa-...@googlegroups.com
Peter Stuifzand <peter.s...@gmail.com> writes:
> As far as I know I don't do that. And it's not my intention.

Ah, sorry, I should have looked closer---I was going by the name of the
github project, but I see that the actual libs you implement are indeed
under MarpaX.

Regardless, this is very, very cool.

Mike.

Peter Stuifzand

unread,
Mar 16, 2012, 11:02:52 AM3/16/12
to marpa-...@googlegroups.com
Thank you.

--
Peter Stuifzand

Jeffrey Kegler

unread,
Mar 26, 2012, 8:00:44 PM3/26/12
to marpa-...@googlegroups.com
I've enjoyed reading and rereading this, the Marpa-written-in-Marpa page of code especially.  It's a lovely demo.

Btw, I'd love to see something along this lines become the interface to Marpa, relegating Marpa::XS and Marpa::R2 to testing frameworks.  My last blog post was about interfaces which "want" to become languages.  Marpa is one of them.

Peter Stuifzand

unread,
Mar 28, 2012, 2:45:51 PM3/28/12
to marpa-...@googlegroups.com
Hi,

first, thank you Jeffrey,

the first version of the parser that I wrote just fits so well into
the arguments to Marpa::XS. I think it would be really cool to have a
well written module that just creates a package that creates a package
with a parser. With examples and a tutorial. Maybe in the form of two
packages:

1. A Marpa base grammar, parser, code generator, that creates a module
that generates code one-to-one for the arguments of Marpa::XS.
Everything that could be specified in Marpa::XS->new(...) is an
expression in that parser.

2. A module that generates a version of (1) that includes syntactic
sugar for writing for rules could be found in RFC's for example.
Extended rules like character ranges (for tokens) or minimum and
maximum count or alternation. To make parsers shorter.

Just thinking aloud here. I would also love to see people use the code
as it stands and maybe write a few small parsers.

--
Peter Stuifzand

Reply all
Reply to author
Forward
0 new messages