Antlr interest
   6 tags on

1 answer

Parsing fortran-style .op. operators

I'm trying to write an ANTLR4 grammar for a fortran-inspired DSL. I'm having difficulty with the 'ole classic ".op." operators: if (1.and.1) then where both "1"s should be intepreted as integer. I …

18 mins ago
3 answers

Is there a version of Javacc that outputs javascript code?

I am looking for a parser generator that accepts a Javacc grammar file (.jj) and generates a parser in Javascript (instead of Java). Does such a thing exist? Alternately how difficult would it be to …

1 answer

Contention in Antlr4.Runtime.Dfa.DFAState.Get/SetTarget() (version 4.2.2-alpha001)

We're running a .NET application that using this version of the parser in highly parallel manner. We are parsing single lines of input at a time on a given thread on which the parser/lexer is ...

6 hours ago
1 answer

Lexer predicate for XPath 3 comments

I am trying to implement an XPath 3 parser in Antlr 4. In the EBNF given in the XPath specification it makes use of - to indicate that something should be excluded, if I understand correctly, then in …

6 hours ago
1 answer

Increase Performance of Semantic Predicate

I'm working on parsing a language that will have user-defined function calls. At parse time, each of these identifiers will already be known. My goal is to tokenize each instance of a user-defined …

10 hours ago
1 answer

Eclipse XText Object Oriented Grammar

I am a rookie in XText and have built my own scripting language but now I want to start to be able to add stuff like namespaces and new object creation from other classes that are imported and ...

15 hours ago
4 answers

Using ANTLR 3.3?

I'm trying to get started with ANTLR and C# but I'm finding it extraordinarily difficult due to the lack of documentation/tutorials. I've found a couple half-hearted tutorials for older versions, but …

18 hours ago
1 answer

an antlr4 parser in C# — seems right but does not work

grammar CSVParser; // table : line+; line : NAME ',' PEAK ',' STARTYEAR ',' ENDYEAR ',' LENGTH NEWLINE ; NEWLINE : '\r'? '\n' ; NAME : ('"'(~'"')*'"') ; PEAK : …

yesterday
1 answer

How to throw an exception from ANTLR4 script?

I want my Antlr4 parser to throw RecognitionException when it doesn't understand the input and when the perfectly parsed input doesn't satisfy my custom requirements. In other words, I want to find an …

yesterday
1 answer

Visitor/Listener code for a while loop in ANTLR 4

So far i have searched the whole "The Definitive ANTLR 4 Reference" book as well as many sites for an answer to my question and i still can't find anything on the topic. I am using ANTLR 4 to create …

yesterday
3 answers

Mismatched input antlr4 misinterpreting

I got stuck with my compilerproject for university and have trouble parsing the following input haupt() { while(i==2) { (5+2)*3 } } with this grammar: grammar Demo; @header { …

1 answer

ANTLR4 visitor pattern on simple arithmetic example

I am a complete ANTLR4 newbies, so please forgive my ignorance. I ran into this presentation where a very simple arithmetic expression grammar is defined. It looks like: grammar Expressions; start : …

2 days ago
1 answer

How to get values from an expression

I am using grammar from https://github.com/antlr/grammars-v4 and trying to populate column name and value that comes in the where clause. The problem I am having is how to determine if ...

2 days ago
1 answer

How to generate AST in ANTLR4?

I'm working on a project in which I have to generate Abstract Syntax Tree for a given program. Here program can be in any mainstream programming languages. What should be the standard way of ...

2 days ago
2 answers

Dealing with overloaded symbols in ambiguous grammars in ANTLR4

I am trying to write a parser for a dialect of Answer Set Programming (ASP) which, in terms of grammar, looks like Prolog with some extensions. One extension, for instance is expansion, meaning that …

0 answers

Extracting information from AST

I am trying to use ANTLR to extract information from a PLSQL file. I am using porcelli PLSQL grammar, using which ANTLR spits out AST on my input plsql file. I need to read the returned "CommonTree" …

0 answers

Antlr, please tell me about walker-tree

Sorry for my english, I'm from Ukraine. Please tell me how to make a walker-tree on antlr. On assignment I need to implement the computation, for example a + b. Before that I just created rules for …

2 days ago
1 answer

ANTLR4 C Grammar Not Supporting __cdecl?

I am running ANTLR 4.2 and using the canonical C grammar from: https://github.com/antlr/grammars-v4/tree/master/c I am doing the following steps: (using batch files from the ANTLR4 book) antlr C.g4 …

2 days ago
1 answer

Simple Island Grammar in ANTLR 4: Token Recognition Error

apparently, I wasn't able to deduce the answers to my problem from exiting posts on token recognition errors with Island Grammars here, so I hope someone can give me an advice on how to do this ...

Apr 14 at 21:47
1 answer

ANTLR4 not parsing typedef

I am using ANTLR4 and the canonical grammar for C as found here: https://github.com/antlr/grammars-v4/tree/master/c I am not modifying the grammar in any way. I am finding that the parsing is ...

Apr 14 at 19:11
0 answers

Passing terminal rule as parameter in XText/ANTLR Grammar

Is there a way to pass a terminal rule as a parameter into other rules in XText? I am aware XText uses ANTLR and have looked in documentation for both, but am struggling to find a working solution. …

Apr 14 at 13:41
0 answers

ANTLR4 Error: Exception in thread “main” java

I follow instruction "Getting Started with ANTLR v4" with simple grammar, no problem with other instruction. But I have one problem. Except, I'm starting run grun Expr prog -gui But show this …

Apr 13 at 18:17
4 answers

ANTLR grammar for Scala?

I am trying to build a static analysis tool for a demo project. We are free to choose the language to analyze. I started off by writing a Java code analyzer using ANTLR. I now want to do the same for …

Apr 12 at 13:03
3 answers

Is there way I can modify a ParseTree and it's accompanying TokenStream?

My question is both a language implementation question and an ANTLR4 API question. Is there way I can modify a ParseTree and it's accompanying TokenStream? Here is the scenario. I have a simple ...

0 answers

Mutually left-recursive rule in ANTLR4

I have a grammar with a single parser rule and I´m getting the following error: The following sets of rules are mutually left-recursive [stableId] Why do I get a mutually left-recursive error …

Apr 11 at 20:30
2 answers

Can I remove ANTLR dependencies from generated code?

ANTLR generates java source from the grammar file. Generated source has dependency to ANTLR classes. Can I generate 'clean' java sources using ANTLR, that do not have any antlr - dependecy? If not, …

Apr 11 at 11:17
0 answers

Setup antlr ide and antlr package

I have to create a c compiler. For that i am trying to use ANTLR in eclipse, I installed Antlr ide, but when i try to ANTLR package, it shows error as Invalid ANTLR home Reason: couldn't ...

Apr 11 at 10:16
1 answer

How to make an “global parser rule”?

I'm building a grammar for parsing Quake III shaders with ANTLR4. Here's an exemple of a shader: textures/liquids/lava-example { deformVertexes wave sin 0 3 0 0.1 q3map_tessSize 64 ...

Apr 11 at 8:53
1 answer

Need an ANTLR4 tree walking clue

It's been many years since my (one) compiler course so forgive me if this question is ill-posed. I am also new to ANTLR and a C, not Java, coder. What I'd like to do is describe my problem and then …

Apr 11 at 8:43
1 answer

ANTLR4 yet another left recursion

I'm very ashamed to ask... I wrote a grammar for the language with typecast from int to bool and vice versa. logic_expr : expr NOT? OR | AND expr | expr '|' expr SMALLER | LARGER | ...

Apr 10 at 21:17
15 30 50 per page
1 2 3