Antlr interest
   6 tags on

0 answers

Antlr4: not matched by right gammar

I have faced with very interesting problem. Let's look at it as an example. grammar1: TAG_SYMBOL: '@'; tagSymbol: TAG_SYMBOL; grammar2: TAG_SYMBOL: '@'; TAG: TAG_SYMBOL; tagSymbol: TAG; And ...

0 answers

Escape quote in ANTLR4?

I have this grammar : grammar Hello; STRING : '"' ( ESC | ~[\r\n"])* '"' ; fragment ESC : '\\"' ; r : STRING; I want when i type a string : "my name is : \" StackOverflow \" " the result will ...

1 answer

How to make a token “\” in ANTLR4?

I want to make tokens for integer division and float division For example : DIV_F : '/'; DIV_I : '\'; // Error here There is an error in second line : " mismatched character 'EOF' expecting ''' " ...

1 answers | 2 hours ago by Dương Anh Khoa on Stack Overflow
2 answers

Prevent “Antlr4.Runtime.NoViableAltException” with Antlr

I'm using Antlr 4 (C# implementation) and I'm getting the following exception whenever the string to parse is complex. A first chance exception of type 'Antlr4.Runtime.NoViableAltException' occurred ...

2 answers | 3 hours ago by Nick Gallant on Stack Overflow
0 answers

How to skip initial Whitespace (on first line of input) in antlr3 XML Parser

I'm trying antlr3 for the first time, and I'm experimenting with the following XML Lexer and Parser from these websites: ...

1 answer

RuntimeException with Antlr4 and IntelliJ on Mac

I use IntelliJ 14.1.3 and its Antlr4-Plugin to code grammar code with Antlr4 on a Mac Yosemite. I added the antlr-4.5-complete.jar as library and with the plugin tool i create lexer and parser files. ...

1 answers | 5 hours ago by Pille on Stack Overflow
0 answers

Need for [System.Serializable] in antlr4 c# source code

I need to know why there is need to serialize almost all the classes in c# code of Antlr4. Is it an add on to the functionality, say one could convert tree as byte code or is it part of core ...

1 answer

antlr4 and international characters

I have been using antlr4 to parse a German document and so far I have done the following to parse the text that includes German characters: LETTERS: ...

1 answers | 12 hours ago by Makan Tayebi on Stack Overflow
0 answers

Compiling sample ANTRL4 output

From the Definitive ANTLR4 reference I have run through the first example and it has generated the JAVA target. In the directory C:\JavaLib I have antlr-4.5-complete.jar When I attempt to compile it ...

1 answer

System Verilog 2012 dependency analysis

I am in the process of adapting the System Verilog LRM into Antlr4. This is a huge overkill for what I really need, however. Basically I need dependency analysis similar to the -M switch in gcc. This ...

1 answers | 2 days ago by sean on Stack Overflow
0 answers

Should a VBScript lexer accept '&htmlTag'? If so, how with an ANTLR3 lexer?

While parsing VBScript code with my ANTLR3 parser, I found it processes everything except x = y &htmlTag This code is obviously meant as "x = y & htmlTag". (Me, I put spaces around ...

1 answer

building an AST with antlr4 for the java language

I am trying to construct an AST using the latest version of ANTLR (v4), i found a couple of links here in stack-overflow and also on the net, that shows you how to do it for a simple grammars. ...

2 answers

Error in ANTLR4 when parsing for EOF

I am new to ANTLR (any version) and I am just getting started writing my first grammar file. I'm using the IntelliJ IDE with the ANTLR plugin (v1.6). My grammar is grammar TestGrammar; testfile ...

2 answers | Jul 3 at 7:47 by Anthony on Stack Overflow
0 answers

StackOverflowError in ANTLR4

I am new to ANTLR and trying out parsing a ASP file. I am getting following error while walking the tree. Exception in thread "main" java.lang.StackOverflowError at ...

1 answer

Express a rule with ANTLR4

I must define a rule which expresses the following statement: {x in y | x > 0}. For the first part of that comprehension "x in y", i have the subrule: FIRSTPART: Name "in" Name , whereas Name can ...

1 answers | Jul 2 at 18:40 by user3097712 on Stack Overflow
2 answers

Possible generation bug for C# in Antlr?

Using Antlr 4.3 and this grammar following *Lexer.cs code for C# is generated : private void WHITESPACE_action(RuleContext _localctx, ...

2 answers | Jul 2 at 17:31 by Markus Reinke on Stack Overflow
1 answer

Include whitespaces in “No viable alternative at input”-exception in ANTLR4

When parsing my document and providing code that has no viable alternative with ANTLR4 I properly receive a SyntaxError in my ErrorHandler with the message: no viable alternative at input ...

1 answer

ANTLR : Have errors with Fragment

The error is : mismatched input 'elseState' expecting RULE_TOKEN_REF Can someone explain to me why do i have this error and how to fix it ? Your help will be appreciated

1 answers | Jul 2 at 16:52 by Dương Anh Khoa on Stack Overflow
1 answer

Drag and Drop visual editor in Eclipse

In my current project, I write high-level specification ( as indicated below for reference) and am parsing it using grammar written in ANTLR and then using StringTempate to generate equivalent Java ...

1 answer

ANTLR4 Error : Missing NEWLINE

grammar Hello; prog: stat+ EOF; stat: expr NEWLINE # printExpr | ID '=' expr NEWLINE # assign | NEWLINE # blank | STRING NEWLINE # string ; expr: expr (MUL|DIV) expr # ...

1 answers | Jul 1 at 19:54 by Dương Anh Khoa on Stack Overflow
1 answer

Process whitespace in specific ANTLR parser rule but skip it in all other cases

maybe someone can help me on this. I have written an ANTLR grammar which in short looks like this: grammar myGrammar; file: mystring+; mystring: name EQUALITYSIGN DOUBLEQUOTE stringVal DOUBLEQUOTE ...

1 answers | Jul 1 at 10:52 by YourReflection on Stack Overflow
1 answer

Trying to start ANTLR gives “NoClassDefFoundError”?

I just downloaded ANTLR, and when I try to start it, I get this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/v4/Tool Caused by: java.lang.ClassNotFoundException: ...

1 answers | Jul 1 at 0:26 by Kytuzian on Stack Overflow
1 answer

Get Original Grammar Productions in ANTLR4

Is there any API in ANTLR4 for obtaining the original productions from the grammar? For example, if there was a rule: functionHeader : identifier LPAREN parameterDecl RPAREN ... is there some ...

1 answer

Convert Token Numbers to Strings in ANTLR4

I'm trying to use ANTLR4 to build a sort of autocomplete system using the getExpectedTokens() function that can be called when the parser experiences an error. getExpectedTokens() returns an ...

1 answer

Xtext Grammar Ambiguities (Backtracking is not working)

I am trying to use Xtext to design a simple language for operations on sets of numbers. Here are some examples of strings in the language: {2,1+6} (A set of numbers 2 and 7) {1+3, 3+5} + {2..5} (A ...

1 answer

How to run g4 file by ANTLR4 plugin in Eclipse

I installed ANTLRv4 plugin for my Eclipse and I created a file Hello.g4 : /** * Define a grammar called Hello */ grammar Hello; r : 'hello' ID ; // match keyword hello followed by an ...

1 answers | Jun 30 at 16:11 by Dương Anh Khoa on Stack Overflow
3 answers

grammar files .g compatibility frome Antlr 2.7 to 4?

The situation: We are porting our old simulation platform for math/physics/CS popularization MobiNet from C++ to online JS. At that time the MobiNet language was dealt using Antlr 2.7.3. Can we ...

1 answer

ANTLR4 - keep getting a mismatched input error

I just started working with Antlr 4. I tried to write a grammar rules for a simple program, but I'm having a difficult time getting it to work. I am trying to parse a sequence of lines that look ...

1 answers | Jun 30 at 11:22 by BlastingBlast on Stack Overflow
1 answer

xtext nested {} Decision can match input such as “'}'” using multiple alternatives

I am new to xtext (antlr), and don't understand why there is ambiguity between IconType '}' and WindowType '}'. I get the warning(200): ...

1 answers | Jun 29 at 20:03 by simsulla on Stack Overflow
1 answer

Antlr4 how to avoid syntax errors with anything between quotes rule?

I'm trying to build my own dsl in order to create custom rules to match a given json object. for this purpose I've created so far two kind of rules with the following grammar: grammar RuleGrammar; ...

1 answers | Jun 29 at 17:19 by user3794759 on Stack Overflow
15 30 50 per page
1 2 3