Antlr interest
   6 tags on

2 answers

ANTLR4 Hangs Up When Dealing with EOF

I've a simple ANTLR4 grammar : grammar Test; preprocessing_file: oneline+; oneline: IDENTIFIER? new_line; new_line: EOF|CRLF ; WS: [ \t\f]+ -> channel(2); CRLF: '\r'? '\n'; IDENTIFIER: ...

2 answers | 6 hours ago by JavaMan on Stack Overflow
1 answer

Antlr grammar for a string inside a string

"Choose ""A"" for All Areas." is the string and my grammar rule for string is STRING : '\"' .* '\"' ; its not going in a way I thought and stopped till "choose " . what rule can I write to accept ...

1 answers | 9 hours ago by Karthik Venu on Stack Overflow
1 answer

Query ANTLR4 parse tree whether children were quantified in the grammar rule

Having an ANTLR4 grammar, a matching input and a generated parse tree. Is there any way to find out about a node in the parse tree what kind of quantifier was applied to its definition if any? An ...

1 answers | yesterday by Reni on Stack Overflow
0 answers

how to use logic symbols in antlr project grammar

I'd like to write this grammar to my eclipse for producing a parse tree.. The grammar above needs to be edited first to get the right grammar needed for the creation of the parse tree

1 answer

Wrong AST selection

Given the following ANTLR v3 grammar: tokens { OPTION; UNKNOWN; } statement : my_statement | UNKNOWN_KEYWORD -> ^(UNKNOWN) ; my_statement : FIRST SECOND type = THIRD? ...

1 answers | yesterday by user5793565 on Stack Overflow
1 answer

Loader Constraint Violation loading Antlr jar in Eclipse plugin built with Tycho

I've been working on an Eclipse plugin codebase that builds with Maven Tycho. I can provide some snippets that anyone asks for, but you can get the code at ...

2 answers

Create Java 8 AST with ANTLR4 programmatically

I'm trying to figure out just how exactly to use ANTLR, but I'm having a really difficult time digesting the things I've found. So far, here are my resources: How to create AST with ANTLR4? How can ...

2 answers | 2 days ago by djthoms on Stack Overflow
1 answer

Antlr4 - Ordering of clauses

I have this rule: query : SELECT selectAttribute (',' selectAttribute)* FROM from (WHERE where=booleanExpression)? (ORDER BY sortItem (',' sortItem)*)? (LIMIT ...

1 answers | Apr 27 at 19:07 by Flukey on Stack Overflow
1 answer

How to write a lexer rule that references a character?

I want to create a lexer rule that can read a string literal that defines its own delimiter (specifically, the Oracle quote-delimited string): q'!My string which can contain 'single quotes'!' where ...

1 answers | Apr 27 at 19:06 by Stephen Drew on Stack Overflow
0 answers

How to get to parser context (and custom member) from ANTLR3_BASE_RECOGNIZER_struct in antlr3 C runtime in displayRecognitionError

I want to override the displayRecognitionError method in an antlr3 C runtime project. The grammar file looks a bit like this: @parser::context { struct parser_data* parser_data; } @parser::apifuncs ...

2 answers

Java Tree parser output for ANTLR

I've found a sample template in the ANTLR website, its the Javatreeparser.g, which the site says could produce the AST that I need, but since I'm new to ANTLR, how do I make it show? What I've done so ...

1 answer

Antlr4 Parsing dates

I am trying to parse a date using Antlr4 with C# as a target. A valid date in my case should have the following be in year / month / day format year MUST have only 4 digits month and day MUST have ...

1 answers | Apr 26 at 12:42 by Athafoud on Stack Overflow
1 answer

Converting from Antlr3 to Antlr4

I am in the process of converting an antlr3 to antlr4 grammar. I have stripped out all the syntactic predicates. I am struggling to make a correct conversion of this relaxed_date_month_first : ...

1 answers | Apr 26 at 11:46 by fshock on Stack Overflow
1 answer

how to install ANTLR 4.5.3 tool jar for eclipse-plugin development?

I need to use ST4 for my eclipse plugin development project. As stated by antlr guys, the last version 4.5.3 is osgi ready and have st4 in his tool package. How can I install it, so it appear in the ...

0 answers

no viable alternative at input - ANTLR

I'm creating a grammar to read a text file, but it gives always the same error: no viable alternative ANTLR: prog: stat+ ; stat: expr NEWLINE #assign | NEWLINE # blank ; expr: ID ASPAS ...

Apr 26 at 0:53 by Joseph on Stack Overflow
2 answers

Using ANTLR4 lexing for Code Completion in Netbeans Platform

I am using ANTLR4 to parse code in my Netbeans Platform application. I have successfully implemented syntax highlighting using ANTLR4 and Netbeans mechanisms. I have also implemented a simple code ...

2 answers | Apr 25 at 19:34 by padde on Stack Overflow
1 answer

ANTLR4: lexer debugging/tracing

How can I debug/trace/dump the paths the ANTLR4-generated lexer chooses? Many times I am out of luck to see in the grammar itself what went wrong.

1 answers | Apr 25 at 16:27 by TFuto on Stack Overflow
1 answer

Antlr 4 - C#: Raise Custom Events on Parsing Errors

I'm using Antlr 4 with C# as target, and I want to raise an event when a syntax error occurs. my grammar /* * Parser Rules */ text : term+ EOF ; term : a1 a2 a3 ; a1: .... ... ... When ...

1 answers | Apr 25 at 11:11 by Lio on Stack Overflow
1 answer

antlr4 grammar for interpreter - defining entry point in input file

I'm trying to get my head around how to cause antlr4 to execute at a given point in an input file and not at the top. I've taken advice from SO users and started a solution using Antlr4 Visitors. My ...

1 answers | Apr 25 at 1:58 by KevinY on Stack Overflow
1 answer

antlr is there any way to generate the visitor code(generic visitor)

We would like to have the CommonTree have a visit(OurVisitor visitor) method but CommonTree is not a generated class. Right now, we have this code ANTLRStringStream stream = new ...

1 answers | Apr 23 at 19:14 by Dean Hiller on Stack Overflow
0 answers

Antlr difference between BaseErrorListener and visitErrorNode in ParseTreeListener

Kindly let me know the difference between BaseErrorListener and visitErrorNode and when they should be used.

Apr 23 at 9:44 by Abhi on Stack Overflow
0 answers

Create an AST node for a rule

Is there a simple syntax for creating an AST node for a parser rule? Something that will have the same effect in constructing the AST as the following: rule : complex_expr -> ^(ImaginaryToken ...

1 answer

Override Single Rule in ANTLR4 Grammar

I've developed a SQL-2003 ANTLR4 grammar for the project DeveelDB: this defines the main SQL statements for its basic features. Anyway, we're also developing a set of external libraries to extend the ...

1 answers | Apr 22 at 9:00 by Antonello on Stack Overflow
0 answers

ANTLR v4 finishing MySQLGrammar

I am implementing a MySQLParser and for that I am using Antlr v4. The thing is that I am using these official grammars: The thing is that the ...

1 answer

Antlr ignoring characters such as ~,@,#,$,%,*,(,),{,},[,]

The Antlr somehow ignores the characters such as ~,@,#,$,%,*,(,),{,},[,] from the input string. I tested the below grammar with input string's such as show~~~, show ~@#$% etc but the Antlr escapes ...

1 answers | Apr 21 at 20:14 by user1836974 on Stack Overflow
1 answer

how can I refactor this ANTLR4 grammar so that it isn't mutually left recursive?

I can't seem to figure out why this grammar won't compile. It compiled fine until I modified line 145 from (Identifier '.')* functionCall to (primary '.')? functionCall I've been trying to ...

1 answers | Apr 21 at 18:49 by EnderShadow on Stack Overflow
0 answers

ANTLR4: Lexer should recover from missing line feed

I try to get all tokens of a line (without a line feed at the end) by calling lexer.getAllTokens() Since, some rules expect a line feed at the end, I might get a token recognition error in some ...

1 answer

C#, ANTLR, ECMAScript grammar troubles

I'm trying to parse JavaScript (ECMASCript) with C#. I found the following instruction on how to create new project: So I've downloaded ...

1 answers | Apr 21 at 10:36 by AlexAtNet on Stack Overflow
1 answer

ANTLR: VERY slow parsing

I have successfully split my expressions into arithmetic and boolean expressions like this: /* entry point */ parse: formula EOF; formula : (expr|boolExpr); /* boolean expressions : take math expr ...

1 answers | Apr 21 at 9:28 by Gui13 on Stack Overflow
0 answers

Antlr4 Javascript target - issue with Visitor and labeled alternative

I'm using antlr4 (4.5.3) with Javascript target, and trying to implement a visitor. Following the antlr4 book's calculator example (great book BTW) I'm trying to create a similar grammar: ... expr: ...

15 30 50 per page
1 2 3