lepl antlr grammar

12 views
Skip to first unread message

Luca

unread,
Mar 18, 2011, 5:52:06 PM3/18/11
to lepl
Hi,

I just uploaded an antlr grammar I originally wrote for pyparsing and
that I could convert to lepl... Since I couldn't find any way to
upload a file here, I opened an issue (it is marked as defect, but it
really an enhancement I mean...) and explained there some use case :

http://code.google.com/p/lepl/issues/detail?id=19

The grammar is not complete, but it is working in many cases (one
example grammar taken from the antlr tutorials is part of the tests).
It works like this : it can parse an antlr grammar (
http://www.antlr.org/grammar/ANTLR/ANTLRv3.g ) using lepl rules, then
it uses the parsed rules to create equivalent lepl rules.

Included are some tests, it still lacks single lines and multi line
comments, and also rewrite rules (I think that they should be mapped
using Apply() in lepl, but I am not completely sure).

If anyone finds it useful and needs some extension, I will be glad to
work on it :-)

Best Regards,
Luca

andrew cooke

unread,
Mar 18, 2011, 6:08:41 PM3/18/11
to le...@googlegroups.com

That's neat. Thank-you very much. I'll have a look at it soon (am just
trying to get the Lepl 5 docs ready for release). What sort of licence is it
under? I'll have a look. Also, would some way to upload files be useful? If
you/anyone else wants write access to the repo, I could open it up (I'd like
to retain some kind of control though - for example people could add branches
that could be later merged?). I guess I should look at how Google code
handles these things. Lepl is so little used that I haven't worried about
this before. Andrew

> --
> You received this message because you are subscribed to the Google Groups "lepl" group.
> To post to this group, send email to le...@googlegroups.com.
> To unsubscribe from this group, send email to lepl+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/lepl?hl=en.
>

Luca

unread,
Mar 19, 2011, 3:05:15 AM3/19/11
to lepl
Hi Andrew,
if you are interested I suppose you could simply integrate it into the
lepl code and licence, I do not wish to keep any ownership over it : I
just hope that it can be useful to anyone :-)
Some years ago, I wrote a grammar for antlr too and I was more than
happy to learn that it has been recently used for research purposes...

I think that a grammar repository would really be useful (something
like python "recipes") to share user experiences and examples, the
wiki would be more than enough for that... while probably having
"write access" to the lepl code is not yet needed to me ( I will
gladily ask for it if I will become proficient enough in lepl
code :-) ), I could still contribute by sending diffs and patches to
the grammar and tests, so that you would not need too much time to
integrate them (merging a branch would be a little bit more
difficult)... What do you think about this?

If lepl becomes able to read (and, why not, also write) ebnf/antlr
grammars it could provide a list of compatibility with the grammars in
the antlr repository : I believe that a parser usefulness and
diffusion is also bound to the availability of complex grammars for
well-known standard languages, so it would really be a waste to write
them again for a new parser. It could also easily increase the lepl
test base with real word examples...

Thank you for your support and hard work,
Luca

On Mar 18, 11:08 pm, andrew cooke <and...@acooke.org> wrote:
> That's neat.  Thank-you very much.  I'll have a look at it soon (am just
> trying to get the Lepl 5 docs ready for release).  What sort of licence is it
> under?  I'll have a look.  Also, would some way to upload files be useful?  If
> you/anyone else wants write access to the repo, I could open it up (I'd like
> to retain some kind of control though - for example people could add branches
> that could be later merged?).  I guess I should look at how Google code
> handles these things.  Lepl is so little used that I haven't worried about
> this before.  Andrew
>
> On Fri, Mar 18, 2011 at 02:52:06PM -0700, Luca wrote:
> > Hi,
>
> > I just uploaded an antlr grammar I originally wrote for pyparsing and
> > that I could convert to lepl... Since I couldn't find any way to
> > upload a file here, I opened an issue (it is marked as defect, but it
> > really an enhancement I mean...) and explained there some use case :
>
> >http://code.google.com/p/lepl/issues/detail?id=19
>
> > The grammar is not complete, but it is working in many cases (one
> > example grammar taken from the antlr tutorials is part of the tests).
> > It works like this : it can parse an antlr grammar (
> >http://www.antlr.org/grammar/ANTLR/ANTLRv3.g) using lepl rules, then

andrew cooke

unread,
Mar 19, 2011, 8:17:14 AM3/19/11
to le...@googlegroups.com

Yes, I agree this sounds very cool and useful. The reason I haven't looked at
it yet is that I am trying to get Lepl 5 out this weekend. Once that is done
I will see about adding this into Lepl and also building a set of grammars.

Please can you read and agree to the "developer certificate of origin" at
http://www.acooke.org/lepl/licence.html#contributions ? - that lets me include
it in Lepl (it will still be (c) you (plus me if I make edits)).

Thanks,
Andrew

Luca

unread,
Mar 19, 2011, 6:52:40 PM3/19/11
to lepl
I have read and I fully agree to the "developer certificate of
origin" :-)


Thank you,
Luca

On Mar 19, 2:17 pm, andrew cooke <and...@acooke.org> wrote:
> Yes, I agree this sounds very cool and useful.  The reason I haven't looked at
> it yet is that I am trying to get Lepl 5 out this weekend.  Once that is done
> I will see about adding this into Lepl and also building a set of grammars.
>
> Please can you read and agree to the "developer certificate of origin" athttp://www.acooke.org/lepl/licence.html#contributions? - that lets me include
> it in Lepl (it will still be (c) you (plus me if I make edits)).
>
> Thanks,
> > On Mar 18, 11:08�pm, andrew cooke <and...@acooke.org> wrote:
> > > That's neat. �Thank-you very much. �I'll have a look at it soon (am just
> > > trying to get the Lepl 5 docs ready for release). �What sort of licence is it
> > > under? �I'll have a look. �Also, would some way to upload files be useful? �If
> > > you/anyone else wants write access to the repo, I could open it up (I'd like
> > > to retain some kind of control though - for example people could add branches
> > > that could be later merged?). �I guess I should look at how Google code
> > > handles these things. �Lepl is so little used that I haven't worried about
> > > this before. �Andrew

Luca

unread,
May 9, 2011, 3:27:12 AM5/9/11
to lepl
Hi Andrew,

I just re-read the "contributions" link: would you like me to re-
submit the code while joining a "signing off" ? I would gladly do it
if it helps :-)

Can I do anything to help integrate/enhance the antlr parser? If you
need any explications or documentation, I can do that too if you have
any time now to speak about it, otherwise I can wait of course :-)

I hope everything is fine,
bye

Luca


On 20 mar, 00:52, Luca <luca.dallo...@gmail.com> wrote:
> I have read and I fully agree to the "developer certificate of
> origin" :-)
>
> Thank you,
> Luca
>
> On Mar 19, 2:17 pm, andrew cooke <and...@acooke.org> wrote:
>
> > Yes, I agree this sounds very cool and useful.  The reason I haven't looked at
> > it yet is that I am trying to get Lepl 5 out this weekend.  Once that is done
> > I will see about adding this into Lepl and also building a set of grammars.
>
> > Please can you read and agree to the "developer certificate of origin" athttp://www.acooke.org/lepl/licence.html#contributions?- that lets me include

andrew cooke

unread,
May 10, 2011, 7:30:39 AM5/10/11
to le...@googlegroups.com

Hi,

Sorry - I know I said that I would start working on this in May, but I am
still trying to finish another project, so haven't got to it yet. There's no
problem, and I will address this, I am just still busy with something else.

The only thing I can think of is update it for 5.0, but you did that a while
back...

Currently I expect to start on Lepl in about 2 weeks, but it could be later.

Hope that helps,
Andrew

> > > > On Mar 18, 11:08�pm, andrew cooke <and...@acooke.org> wrote:
> > > > > That's neat. �Thank-you very much. �I'll have a look at it soon (am just
> > > > > trying to get the Lepl 5 docs ready for release). �What sort of licence is it
> > > > > under? �I'll have a look. �Also, would some way to upload files be useful? �If


> > > > > you/anyone else wants write access to the repo, I could open it up (I'd like
> > > > > to retain some kind of control though - for example people could add branches

> > > > > that could be later merged?). �I guess I should look at how Google code
> > > > > handles these things. �Lepl is so little used that I haven't worried about
> > > > > this before. �Andrew

andrew cooke

unread,
May 9, 2011, 12:08:13 PM5/9/11
to le...@googlegroups.com

Also, I thought you already said in an email that you agreed to that
agreement? There's no need to resubmit code. If I'm remembering wrong then
yes, I need you to agree to the certificate (just saying so in an email is
enough).

Thanks,
Andrew

PS Sorry for possible strange date in previous email - clocks changed here and
I managed to add 23 hours instead of subtracting 1.

> > > > On Mar 18, 11:08�pm, andrew cooke <and...@acooke.org> wrote:
> > > > > That's neat. �Thank-you very much. �I'll have a look at it soon (am just
> > > > > trying to get the Lepl 5 docs ready for release). �What sort of licence is it
> > > > > under? �I'll have a look. �Also, would some way to upload files be useful? �If


> > > > > you/anyone else wants write access to the repo, I could open it up (I'd like
> > > > > to retain some kind of control though - for example people could add branches

> > > > > that could be later merged?). �I guess I should look at how Google code
> > > > > handles these things. �Lepl is so little used that I haven't worried about
> > > > > this before. �Andrew

Luca

unread,
May 10, 2011, 2:54:41 AM5/10/11
to lepl
Hi Andrew,

don't worry at all, I have quite a lot of things to do too :-) Anyway,
I am here if you need me :-)

Luca

On 10 mai, 13:30, andrew cooke <and...@acooke.org> wrote:
> Hi,
>
> Sorry - I know I said that I would start working on this in May, but I am
> still trying to finish another project, so haven't got to it yet.  There's no
> problem, and I will address this, I am just still busy with something else.
>
> The only thing I can think of is update it for 5.0, but you did that a while
> back...
>
> Currently I expect to start on Lepl in about 2 weeks, but it could be later.
>
> Hope that helps,
> AndrewOn Mon, May 09, 2011 at 12:27:12AM -0700, Luca wrote:
> > Hi Andrew,
>
> > I just re-read the "contributions" link: would you like me to re-
> > submit the code while joining a "signing off" ? I would gladly do it
> > if it helps :-)
>
> > Can I do anything to help integrate/enhance the antlr parser? If you
> > need any explications or documentation, I can do that too if you have
> > any time now to speak about it, otherwise I can wait of course :-)
>
> > I hope everything is fine,
> > bye
>
> > Luca
>
> > On 20 mar, 00:52, Luca <luca.dallo...@gmail.com> wrote:
> > > I have read and I fully agree to the "developer certificate of
> > > origin" :-)
>
> > > Thank you,
> > > Luca
>
> > > On Mar 19, 2:17 pm, andrew cooke <and...@acooke.org> wrote:
>
> > > > Yes, I agree this sounds very cool and useful. The reason I haven't looked at
> > > > it yet is that I am trying to get Lepl 5 out this weekend. Once that is done
> > > > I will see about adding this into Lepl and also building a set of grammars.
>
> > > > Please can you read and agree to the "developer certificate of origin" athttp://www.acooke.org/lepl/licence.html#contributions?-that lets me include

andrew cooke

unread,
May 28, 2011, 9:22:05 AM5/28/11
to le...@googlegroups.com

An update on this: the way that Antlr and Lepl handle tokens isn't the same.
To reproduce the behaviour of Antlr correctly I need to extend how tokens are
handled in Lepl. Since there is no point in working on Lepl's tokens without
updating the regular expression handling (since that will have a larger
impact) I am extending the reular expression handling first (this is the
opposite order to what I explained originally).

Andrew

Luca

unread,
May 30, 2011, 4:14:50 AM5/30/11
to lepl
Hi Andrew,

that's interesting (I must admit that I didn't compare the two parsers
at that level), I understand the priority change: it seems the only
reasonable thing to do :-)
If you think that filling some gaps in the lepl antlr grammar
implementation could help later, I think I can work on it : in
particular, I still had to implement single line and multi line
comments (which I think are natively implemented in antlr), is this a
part of your work on tokens too or I could work ( given a few hints,
hopefully ;-) ) on it ?

Best Regards,

Luca
Reply all
Reply to author
Forward
0 new messages