Antlr interest
   6 tags on

1 answer

Read multiline value in ANTLR untill a special symbol occurs

How can i read a multiline text in ANTLR untill a special symbol occurs. Like as in below text:- @Description(" Hi There I am. ") I need to read it as key -> @Description and value -> "Hi There I ...

1 answer

How can we convert regular expression to ANTLR 4 Expression

I was searching for a way or tool to convert the regular expression into the ANTLR 4 expression but could not find anything suitable. Now i'm curious "Can we actually convert it or not." If not, then ...

0 answers

Get values from star/plus rules in ANTLR

I'm writing an ANTLR grammar (compiled into java) and I have the following code: program returns [Program value] : PROGRAM d=decl* s=stmt+ END {$value = new Program($d.value, $s.value);} ; ...

0 answers

ANTLR3 : MissingTokenException when using already defined token in input in place of ID

I stumbled upon this problem while writing grammar rules for create table. My grammar is failing when column names are already defined tokens in the grammar (can't have column name 'create' matched ...

1 answer

ANTLR 3: passing value to Lexer (C target)

Is there a mechanism to pass a value to a lexer? (I'm working with C target in ANTLR 3) Some other search results had suggested putting a function and var into the member area: @members { bool ...

1 answers | yesterday by Sam G on Stack Overflow stackoverflow.com
1 answer

ANTLR failure due to left recursion. How to solve?

Here is a simple grammar for an SQL select statement grammar SQL; @rulecatch { //We want to stop parsing when SyntaxException is encountered //So we re-throw the exception catch ...

2 answers

ANTLR + Scala : ideas for improvements?

I'm trying to find a way to integrate an antlr parser in the realm of Scala. I've tried visitors coded in scala to build scala objects from the parse tree, but the restriction to have a uniform ...

2 answers | 2 days ago by remi on Stack Overflow stackoverflow.com
1 answer

ANTLR4: Correctly matching common prefixes

I have the following ANTLR4 grammar: grammar test; start_symbol: '(FILE' line* ')' EOF ; line: '(' ID ')' ; ID: [a-zA-Z_] [a-zA-Z0-9_]* ; White_space : [ \t\n\r]+ -> skip ; ... and it ...

1 answers | Nov 25 at 15:32 by saum on Stack Overflow stackoverflow.com
0 answers

Antlr Error Strategy to skip tokens until rule matches again

I tried this solution but it didn't seem to work for me Here's an excerpt from my grammer: module : BEGIN MODULE IDENT STRING module_element* END MODULE ; module_element : element_1 | ...

1 answer

Consume only commented (/** … */ )section of java file thorugh ANTLR 4 and skip the rest

I'm new to ANTLR and getting familiar with ANTLR 4. How to consume only the commented section (/** ... */) from a java file(or any file) and skip the rest. I do have the following file "t.txt" :- ...

1 answers | Nov 23 at 15:34 by Abhishek-Java on Stack Overflow stackoverflow.com
0 answers

Can ANTLR lexers/parsers be used for VS syntax highlighting and Error List?

I'm happily developing a language in ANTLR 4.4 / ANTLR4CS, and I'd like to start integrating my language into an IDE. The natural place for me feels like integrating it into Visual Studio. It occurs ...

2 answers

mismatched Input when lexing and parsing with modes

I'm having an ANTLR4 problem with mismatched input but can't solve it. I've found a lot of questions dealing with that, and the usually revolve around the lexer matching something else to the token, ...

2 answers | Nov 22 at 14:26 by Rosenheimer on Stack Overflow stackoverflow.com
0 answers

ANTLR ambigous grammar

I have trouble disambiguating the following grammar methodBlock : expr ';'! ; castExpr : '{' ID expr '}' -> ^(CAST ID expr) ; dispatchExpr : '[' expr ( expr ','?)* ']' -> ...

1 answer

Are there ANTLR .stg template files available in different encodings?

I am trying to generate ANTLR (3.1.3) files on a local EBCDIC charset system. It appears the template files are in ASCII encoding. Do I have to convert all the template files by hand? Do I only need ...

1 answers | Nov 21 at 9:15 by Sam G on Stack Overflow stackoverflow.com
1 answer

ANTLR String LEXER token

I am trying to do a STRING lexer token. My problem is that besides \n, \r, \t any character is himself (for example \c is c). That being said i have the following example: "This is a valid \ ...

1 answers | Nov 20 at 22:15 by Catalin Ichimov on Stack Overflow stackoverflow.com
0 answers

Internal EBCDIC support for ANTLR 3.1.3?

I'm trying to use ANTLR 3.1.3 on a system with local EBCDIC char set Even a simple grammar like this: lexer grammar test; GENERIC_ID : (LETTER)* ; fragment LETTER : 'a' .. 'z' ; results in these ...

1 answer

ANTLR decision can match input such as “ID ID” using multiple alternatives

I am having a problem with the disambiguation of this parser. I would like to mention that i am using antlrworks 1.4.3(it's a must i use it, homework assignment). I also must not use backtrack=true ...

1 answers | Nov 20 at 20:34 by Catalin Ichimov on Stack Overflow stackoverflow.com
2 answers

any antlr4 equivalent to the 'not' scala parser combinator?

I'm porting a grammar from scala combinators to antlr4, and the original grammar uses the 'not(p: Parser) ' parser combinator, which succeeds when the enclosed parser fails. In the parser I am ...

1 answer

ANTLR4 custom tokens

I am using C# version for generating ANTLR4 files. I have used custom tokens by using this option TokenLabelType=Token. Everything is fine but c# compiler gives error in MAtch(..) and input(...) ...

1 answers | Nov 20 at 5:17 by Grace Leelavathy on Stack Overflow stackoverflow.com
0 answers

Bill of work for Postgres Variant Grammar

I have to unit test scripts for a postgres(PG) derivative dialect called AWS redshift that has a few features that are not backward compatible with PG. I am unit testing redshift SQL code on PG by ...

Nov 19 at 18:56 by Sid on Stack Overflow stackoverflow.com
1 answer

ANTLR Parser matching token not identifier

I am writing a parser for SQL statements. I defined tokens for the keywords like: tokens { CREATE = 'create'; TABLE = 'table'; YEAR = 'year'; NAME = 'name'; ... } and Identifier as IDENTIFIER ...

1 answers | Nov 19 at 9:19 by user82504 on Stack Overflow stackoverflow.com
1 answer

How to make same lexer for two parser grammars

I am writing a parser for a language. After implementation I have found that there are so many parser rules. So, I split the grammars. I have added the lexer rules in both the grammars. But, now I ...

1 answers | Nov 19 at 8:51 by user82504 on Stack Overflow stackoverflow.com
1 answer

Antlr4 parser not handling custom token types

I am migrating my grammar from version 3 to 4. I recognize that version 4 has listeners and visitors and I plan to use them, but hope to do the migration piece meal. I want to leave actions intact ...

1 answers | Nov 19 at 2:20 by Todd347 on Stack Overflow stackoverflow.com
1 answer

How do you handle the values of the symbols in the symbol table?

In reference to chapter 6 of your book "Language Implementation Patterns"; what is the best practice/pattern for storing and retrieving values for each symbol. Every symbol has a name, a type and a ...

1 answers | Nov 19 at 1:26 by user2310417 on Stack Overflow stackoverflow.com
1 answer

What is the purpose of Antlr package in Visual Studio 2013 ASP.NET project?

The ASP.NET (web forms) project template in Visual Studio 2013 includes several packages. I'm trying to figure out which ones are essential (may need to create a separate question for this). The post ...

2 answers

When do we use ANTLR

Can anyone please guide me the purpose of using ANTLR dlls in a ASP.Net, C# project. I just noticed antlr.runtime, Antlr3.Runtime, Antlr3.Utlility assemblies being referenced in some project. Will ...

2 answers | Nov 19 at 1:05 by iniki on Stack Overflow stackoverflow.com
1 answer

Using ANTLR4 translating from DSL to Java, need strategy for rebuilding (not evaluating) expressions

I am using ANTLR4 to translate ("compile") from a simple artificial programming language with limited vocabulary to Java. As this exercise does not require any evaluation, and so even conditional ...

1 answer

Trying “simple” parsing w/ antlr4 to reformat / pretty-print

Scenario: I receive a mystery language with obviously very deep syntax Enormous 10k mess, on a single line, represents 1 statement in mystery language Suppose I don't initially care about the deep ...

1 answer

How to use the ANTLR 4 TestRig to show which lexer rule is used when tokenizing input?

I have an ANTLR 4 lexer grammar with a BEGIN lexer rule and an ID lexer rule: lexer grammar Begin; BEGIN : 'begin' ; ID : [a-z]+ ; WS : [ \t\r\n]+ -> skip ; After ...

0 answers

JavaFX8 Background Thread still interferes with GUI

I want to write a JavaFX GUI that loads and parses a bigger file (22M) which takes about 30 seconds. However, when I start the parsing in a Task, the rest of the GUI is pretty unresponsive. It is ...

15 30 50 per page
1 2 3