Convert v3 grammar to v4?

311 views
Skip to first unread message

Otis Gospodnetic

unread,
Mar 5, 2014, 10:03:28 AM3/5/14
to antlr-di...@googlegroups.com
Hi,

I have a grammar that was written for ANTLR 3.  I saw https://theantlrguy.atlassian.net/wiki/pages/viewpage.action?pageId=1900596 (about ANTLR 4) and am wondering the following:
* is it possible to use v3 grammar with ANTLR 4?
* is it possible to give ANTLR 4 the v3 grammar and have ANTLR 4 output the v4 version of the same grammar?

Thanks,
Otis
--
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/


Terence Parr

unread,
Mar 5, 2014, 12:59:19 PM3/5/14
to antlr-di...@googlegroups.com
Hi v3 grammars are easy to convert; just remove syntactic predicates
and it'll be close. I can look for you. ptr to grammar?
T
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Otis Gospodnetic

unread,
Mar 5, 2014, 4:15:49 PM3/5/14
to antlr-di...@googlegroups.com
Otis
--
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/


--
You received this message because you are subscribed to a topic in the Google Groups "antlr-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/antlr-discussion/KqANyZqXvTo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to antlr-discussi...@googlegroups.com.

Terence Parr

unread,
Mar 5, 2014, 7:16:39 PM3/5/14
to antlr-di...@googlegroups.com
Hi. well now we create parse trees automagically not AST so all -> would have to go.  Also there is a LOT of raw code in there. might take some tweaks to preserve meaning. 

All in all, doesn't look too scary. have you tried it? ;)
T

Sam Harwell

unread,
Mar 6, 2014, 12:42:29 AM3/6/14
to antlr-di...@googlegroups.com

Hi Otis,

 

I’m taking a look at this.

 

Sam

Sam Harwell

unread,
Mar 6, 2014, 3:38:47 PM3/6/14
to antlr-di...@googlegroups.com

Hi Otis,

 

I sent a pull request that shows all the steps I went through to convert your project from ANTLR 3 to ANTLR 4.

https://github.com/senseidb/sensei/pull/23

 

As described in the pull request, it’s not 100% done, primarily because I didn’t duplicate the error messaging you put in place for ANTLR 3. However, it should provide you with a reasonable starting place for the transition.

 

Thanks,

Sam

Otis Gospodnetic

unread,
Mar 6, 2014, 4:11:30 PM3/6/14
to antlr-di...@googlegroups.com
Wow, thank you Sam! :)

I'll ping Sensei devs to see if they want to accept this quickly.

Otis
--
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/


Reply all
Reply to author
Forward
0 new messages