antlr4 Questions
1
Solved
I'm trying to parse a Nested Boolean Expression and get the individual conditions within the expression separately. For e.g., if the input string is:
(A = a OR B = b OR C = c AND ((D = d AND E = e...
1
Solved
I am getting the errors label assigned to a block which is not a set. This error occurs for my labels: child, left, right, first, and last. What I am doing is assigning a label to a group of altern...
1
Solved
I'm running code from here: https://github.com/bkiers/antlr4-csv-demo.
I want to view the tokens analyzed by the lexer by adding this line:
System.out.println("Number of tokens: " + tokens.getToke...
1
Solved
I'm trying to install the ANTLR 4 IDE on Eclipse Luna (4.4). I've installed it from the Marketplace but I have no idea how to create a project that has an ANTLR 4 Lexer/Parser in it.
When I go to ...
1
The import statement or the tokenVocab option can be put in a parser grammar to reuse a lexer grammar.
Sam Harwell advises to always use tokenVocab rather than import [1].
Is there any difference...
Prevision asked 3/3, 2015 at 10:10
1
Solved
I am using a parser grammar and a lexer grammar for antlr4 from GitHub to parse PHP in Python3.
When I use these grammars directly my PoC code works:
antlr-test.py
from antlr4 import *
# from P...
1
I am trying to create a simple for now only integer-arithmetic expression parser. For now i have:
grammar MyExpr;
input: (expr NEWLINE)+;
expr: '(' expr ')'
| '-' expr
| <assoc = right>...
2
Solved
Many languages bound a string with some sort of quote, like this:
"Rob Malda is smart."
ANTLR 4 can match such a string with a lexer rule like this:
QuotedString : '"' .*? '"';
To use certain c...
1
Solved
I'm trying to use ANTLR4 to parse input strings that are described by a grammar like:
grammar MyGrammar;
parse : PREFIX? SEARCH;
PREFIX
: [0-9]+ ':'
;
SEARCH
: .+
;
e.g. valid input stri...
2
Solved
I am not so familiar with antlr. I am using version 4 and I have a grammar where whitespace is not important in some parts (but it might be in others, or rather its luck).
So say we have the follo...
Circumpolar asked 8/4, 2015 at 20:41
1
Solved
I'm building simple grammar for programming laguange for learning purposes.
I run into strange error that make no sense to me.
line 1:0 missing {'void', 'int', 'bool', 'string', 'union'} at 'void...
1
Solved
I have an antlr4 grammar designed for an a domain specific language that is embedded into a text template.
There are two modes:
Text (whitespace should be preserved)
Code (whitespace should be i...
6
Solved
The antlr4-maven-plugin does not appear to be document on the Antlr4 website.
Avalos asked 10/3, 2013 at 16:52
3
I've built a grammar for a DSL and I'd like to display some elements (table names) in some colors. I output HTML from Java.
columnIdentifier :
columnName=Identifier
| tableName=Identifier '.' co...
2
Solved
I'm new using Antlr4 but I know that exist a plugin for Eclipse.
I have a simple question...After I created the g4 file how can I visualize the live parse tree in order to see the tree of an input ...
Balch asked 30/4, 2014 at 13:40
1
Solved
I have a ParseTree listener implementation that I'm using to fetch global-scope declarations in standard VBA modules:
public class DeclarationSectionListener : DeclarationListener
{
private bool ...
Johnathon asked 15/2, 2015 at 17:42
2
I am using the following ANTLR grammar to define a function.
definition_function
: DEFINE FUNCTION function_name '[' language_name ']'
RETURN attribute_type '{' function_body '}'
;
function_na...
1
I am learning how to use the "more" lexer command. I typed in the lexer grammar shown in the ANTLR book, page 281:
lexer grammar Lexer_To_Test_More_Command ;
LQUOTE : '"' -> more, mode(STR) ;
...
1
In the lexer, tokens can be skipped, keeping them out of the parser, like so:
Whitespace : [ \t\r\n]+ -> skip ;
Is there an equivalent to -> skip for the parser? That is, once a parser rul...
Blinkers asked 28/1, 2015 at 18:3
1
I am using antlr 4.5 to build a parser for a language with several special comment formats, which I would like to stream to different channels.
It seems antlr 4.5 has been extended with a new cons...
1
Solved
I have a simple grammar as follows:
grammar SampleConfig;
line: ID (WS)* '=' (WS)* string;
ID: [a-zA-Z]+;
string: '"' (ESC|.)*? '"' ;
ESC : '\\"' | '\\\\' ; // 2-char sequences \" and \\
WS: [ \...
2
I looked all over the place for how to configure the antlr4 plugin for IntelliJ IDEA. But I can't find anything. I was only able to install the plugin. If I add .g4 files manually for a empty proje...
Mesic asked 9/5, 2014 at 15:28
2
Solved
I don't know, if this question is valid since i'm not very familiar with source code parsing. My goal is to write a source code completion function for one existing programming language (Language "...
Chaff asked 2/11, 2013 at 2:46
1
Solved
I am trying to parse a mathematical formula to a subset of LaTeX using ANTLR4. For example it should parse (a+4)/(b*10) to \frac{a+4}{b\cdot 10}.
My simple grammar creates a tree like this:
Now...
2
Solved
I'm using antlr 4 to write my grammar. I would like to see the gui three generated by my grammar.
When I try to run the example on the antlr site (http://www.antlr.org/wiki/display/ANTLR4/Getting+...
© 2022 - 2024 — McMap. All rights reserved.