antlr4 Questions

1

Solved

I'm trying to parse a subset of cpp source syntax. The follow ANTLR4 parser rules are directly copied from the c++ language specification (except hypens are replaced by underscores): abstract_decl...
Dakar asked 20/4, 2013 at 10:12

1

I have an ANTLR3 grammar that builds an abstract syntax tree. I'm looking into upgrading to ANTLR4. However, it appears that ANTLR4 only builds parse trees and not abstract syntax trees. For ...
Riyal asked 4/4, 2013 at 23:15

1

Solved

I am learning ANTLR4 and was trying to play with lexical modes. How can I have the same token appear in multiple lexical modes? As a very simple example, let's say my grammar has two modes, and I w...
Lakieshalakin asked 4/4, 2013 at 9:25

1

Solved

I'm creating a simple programming language for a school project. I'm using ANTLR 4 to generate a lexer and a parser from my grammar. Until now, I have been using ANTLRs listener pattern to apply th...
Kesler asked 25/3, 2013 at 8:4

1

Solved

Given: grammar Hbs; var: START_DELIM ID END_DELIM; START_DELIM: '{{'; END_DELIM: '}}'; I'd like to know how to change START_DELIM and END_DELIM at runtime to be for example <% and %>. ...
Comer asked 8/3, 2013 at 13:35

1

Solved

In my use case I have to parse several thousand small and independent expressions into a tree representation using a Visitor on the generated parse trees. Currently new streams, lexer and parser in...
Genu asked 6/3, 2013 at 0:16

1

Solved

I am developing a compiler for the real-time language PEARL with ANTLR4. With ANTLR4 my ParseTree is populated with superflous tokens like e.g. semicolons for ending a grammatical unit. Is there...
Oleary asked 3/3, 2013 at 10:36

1

Solved

I am using Antlr4, and here is a simplified grammar I wrote: grammar BooleanExpression; /******************************* * Parser Rules *******************************/ booleanTerm : booleanLi...
Fading asked 28/2, 2013 at 3:49

1

Solved

Adding skip to a rule doesn't do what I expect. Here's a grammar for a pair of tokens separated by a comma and a space. I made one version where the comma is marked skip, and one where it isn't: g...
Knew asked 28/2, 2013 at 7:14

1

Solved

Goal I'm working on a project to create a Varscoper for Coldfusion CFscript. Basically, this means checking through source code files to ensure that developers have properly var'd their variables....
Achromatism asked 24/2, 2013 at 8:52

1

Solved

I am extending a Listener in ANTLR4 and I want to get all of the tokens which are associated with a particular rule in the parser, is there a method in doing that? i.e. myConfiguration: CONFIG EQ...
Deming asked 21/2, 2013 at 16:0

1

Solved

I am extending the baseClass Listener and am attempting to read in some values, however there doesnt seem to be any hierrarchy in the order. A cut down version of my grammar is as follows: start:...
Principate asked 21/2, 2013 at 17:48

2

Solved

How can I make a rule to match all of its alternatives only once in any order, in ANTLR? i.e. rule: ('example\r\n' | 'example2\r\n') nextRule I would like 'example' and 'example2' to match only...
Midyear asked 18/2, 2013 at 10:26

1

Solved

I need help with my ANTLR 4 grammar after deciding to switch to v4 from v3. I am not very experienced with ANTLR so I am really sorry if my question is dumb ;) In v3 I used the following code to d...
Holiday asked 8/2, 2013 at 17:58

1

Solved

I have created a lexer using antlr 4 for tokenizing Turkish natural language texts, what I need to do is to have a token stream which I can fetch tokens one by one. CommonTokenStream returns a List...
Resnick asked 31/1, 2013 at 10:10

2

Solved

In ANTLR 3 you could just do the following: andExpression : (andnotExpression -> andnotExpression) (AND? a=andnotExpression -> ^(AndNode $andExpression $a))* ; Any idea how to do it i...
Boeschen asked 28/1, 2013 at 15:50

1

Solved

trying out upgrading antlr4, I have 2 lines in the grammar that produce the error message: label tok assigned to a block which is not a set Specifically for a grammar line that looks like this...
Cowbell asked 17/1, 2013 at 14:25

2

Solved

how can I find the previous/left token in lexer for example lexer grammar TLexer; ID : [a-zA-Z] [a-zA-Z0-9]*; CARET : '^'; RTN : {someCond1}? CARET ID; // CARET not include this token GLB : {som...
Tafia asked 9/1, 2013 at 20:4

1

Solved

What should I expect from ANTLR 4? Is it faster ANTLR 3? I mean the parsing speed. Note code generation speed would be interesting too. For design reasons?
Towle asked 16/12, 2012 at 10:20

1

Solved

How would you translate this portion of code written in ANTLR 3 into ANTLR 4? expr: (Identifier '.')=> (refIdentifier) | (Identifier '!')=> (refIdentifier) | (Identifier '=>')=> (lam...
Chancy asked 1/12, 2012 at 17:22

1

Solved

In What is a 'semantic predicate' in ANTLR3? Bart Kiers gives a very well overview about the different semantic predicates in Antlr3. Too bad the syntax/semantics were seemingly changed in Antlr4,...
Longshoreman asked 5/10, 2012 at 15:17

2

Solved

Does anyone know if there is an existing existing ANTLR or IRONY grammar for R? Many thanks.
Offish asked 18/4, 2011 at 15:54

1

Solved

How can the negation meta-character, ~, be used in ANTLR's lexer- and parser rules?
Subchloride asked 27/11, 2011 at 10:30

2

Solved

What is a semantic predicate in ANTLR?
Head asked 16/6, 2010 at 19:16

© 2022 - 2024 — McMap. All rights reserved.