Is there an existing ANTLR or IRONY grammar for R?
Asked Answered
O

2

10

Does anyone know if there is an existing existing ANTLR or IRONY grammar for R?

Many thanks.

Offish answered 18/4, 2011 at 15:54 Comment(8)
Did you already find the Bison/Flex grammar in their SVN repository? If no one posts an ANTLR- or IRONY grammar, you could convert the Bison/Flex to either of those.Apothegm
What do you intend to do with it? Usually having just a parser doesn't buy you much; you typically need an AST, ways to traverse/analyze/modify the AST, etc.Emergence
@Bart Kiers - thanks! I'll certainly look into it!Offish
@Ira Baxter - Apologies if my terms/understanding is incorrect, currently I'm using irony for a small DSL that converts to .net - based on that I've been asked to look at a way to interpret ROffish
"a way to interpret R". This implies you need an AST, means to walk over it program execution order (fun when hit a goto:where is the target in the tree?) and symbol tables (which can answer the "target" question I just asked) as a minimum.Emergence
@Offish can I ask you if you ever resolved this matter? I need similar R parser but RCC site is not providing download link anymore. Can you share your experience please?Floris
@Charles, please leave the tag antlr4 there. The question does not mention that antlr4 cannot be used, and by adding this tag, it will be more easily found. Besides, Terence asked me to create a tag (since he didn't have enough rep to do so at that time) and this being the only question with the antlr4 tag, you removing it caused the "wiki/info" of this tag to be removed as well. Thanks for your consideration.Apothegm
@BartKiers, I will honor your request, however I still object to the tag needing to exist. Tags are for questions, not for answers; there is nothing at all in the question that seems version-specific whatsoever. Perhaps you can find some other questions that could also be tagged with antlr4? This question alone seems like a bad starting point.Snooze
L
7

I've built an R grammar for the early access "Honey Badger" ANTLR v4 release, if you'd like to give it a look. See the ANTLR v4 Examples page. Source for v4 is https://github.com/antlr/antlr4. binary jar here: http://antlr.org/download/antlr-4.0ea-complete.jar For R you want http://www.antlr.org/wiki/download/attachments/28049418/R.g4

Leaper answered 1/2, 2012 at 20:33 Comment(2)
I haven't really looked at v4 yet, but I will do so soon after seeing how ridiculously short that R grammar is. Nice!Apothegm
Some of the links no longer work - any chance of updated ones? ThanksOliphant
E
3

I'd guess a good place to look would be R to C Compiler (RCC) that was developed by John Garvin at Rice

Emergence answered 18/4, 2011 at 17:55 Comment(1)
Thanks Ira - I will check it out and mark your answer accepted if nothing else appears, many thanks.Offish

© 2022 - 2024 — McMap. All rights reserved.