Antlr interest
   6 tags on

3 answers

Antlr4 “Test Rig” and maven

I am struggling a little bit to figure out how I can use the antlr4 maven plug in to run the TestRig class? I've read though the output of mvn antlr4:help -Ddetail=true, which is the only ...

3 answers | 17 mins ago by JustDanyul on Stack Overflow stackoverflow.com
0 answers

How can I write a grammar that matches “x by y by z of a”?

I'm designing a low-punctuation language in which I want to support the declaration of arrays using the following syntax: 512 by 512 of 255 // a 512x512 array filled with 255 100 of 0 // a ...

0 answers

Antlr - SAS Grammar - Parser

I am trying to build a SAS Parser, but i am having trouble treating this construction: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000205244.htm Example: ...

1 answer

ANTLR4 lexer rules don't work as expected

I want to write a lexer rule about the month and the year, the rule is(with regular expression): "hello"[0-9]{1,2}"ever"([0-9]{2}([0-9]{2})?)? the "hello" and "ever" literals are just for debuging. ...

1 answers | yesterday by 大蛋散 on Stack Overflow stackoverflow.com
1 answer

ANTLR error on parsing

i have an problem with antlr. I have the following simple grammar: grammar bxk; options { language=CSharp3; } // start rule start : root* EOF ; root : ROOT_ID CT_ID ...

1 answer

How to create a scanner using regular expressions?

Automated scanner construction refers to regular expressions being used to automatically create scanners, however, I am unsure on how this happens. I am reading 'Engineering a Compiler' to gain some ...

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

exit antlr 3 parser early without raising exception

I am using antlr 3.1.3 and generating a python target. My lexer and parser accept very large files. Based on command-line or dynamic run-time controlled parameters, I would like to capture a portion ...

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

antlr4 simplifying math expression

I'm working on a project to create program using antlr4 to simplifying math expression. For example: x^2 + 2SQRT4 * 8 + x^2 --> 2x^2 + 16SQRT4 I already created gramma: grammar Short INT ...

1 answers | Dec 18 at 21:36 by Kristof on Stack Overflow stackoverflow.com
1 answer

How to describe String that contains characters with range counts under ANTLR4 lexer rules?

There's a rule about the flight no(such as:CZ3102), which has 2 chars followed by 3-4 digits. And its Regular Expression should be: [A-Z]{2}[0-9]{3,4}. Then how to write the lexer rule under ANTLR4? ...

1 answers | Dec 18 at 19:33 by 大蛋散 on Stack Overflow stackoverflow.com
1 answer

Antlr visitor method is never called

I tried to create a simple language, which can evaluate if/else if/else statements and some arithmetic operations with predefined constans. The definition is the following: grammar test; ...

1 answers | Dec 18 at 9:40 by László Halász on Stack Overflow stackoverflow.com
1 answer

how to handling nested comments in antlr lexer

How to handle nested comments in antlr4 lexer? ie I need to count the number of "/*" inside this token and close only after the same number of "*/" have been received. As an example, the D language ...

1 answers | Dec 18 at 9:01 by Rog on Stack Overflow stackoverflow.com
1 answer

Antlr cannot find symbol

I'm working on an ANTLR project that should basically implement this simple grammar: WS : ' ' ; MINUS : '-' ; DIGIT : '0'..'9' ; int4 @init{ int n = 0; } : ...

1 answer

antlr4 - Parsing ALPHANUMERIC that starts with aplhabets

I have the following ABNF rule for string definition. STRING = ALPHA *(allowedchar) allowedchar = "-" / "_" / DIGIT / ALPHA ALPH = A-Z ,a-z Valid tokens: aa1 a_1___a a23 a a-1 a_a (if ...

1 answers | Dec 17 at 8:50 by user1610746 on Stack Overflow stackoverflow.com
0 answers

traverse the AST( generated by anltr) of HQL , but can not return the specified node

all i want to traverse AST and return the specified node . the recursion function have problem, it always could not return specified node. the following is an AST of HQL: ...

0 answers

Generate AST with antlr4 in Eclipse

I am writing a plagiarism detector for source code (for languages like java, c/c++, c#, python, perl, php, etc.), and after experimenting with different approaches like the bag of words, LCS, the ...

1 answer

context in visitor method returns null for sub expressions

so: (1) I'm just a beginner at this whole creating a compiler. (2) I will try hard and put in relevant bits about this, putting in all details would make this question just too long. I will monitor ...

1 answers | Dec 15 at 16:10 by gideon on Stack Overflow stackoverflow.com
1 answer

Antlr4 float parse

I have following antlr4 code: decnum returns [double value] : NUMBER {$value = Double.parseDouble($NUMBER.text);} ; POINT : '.'; INTNUMBER : ('0'..'9')+ ; NUMBER : INTNUMBER (POINT ...

1 answers | Dec 15 at 11:52 by Everv0id on Stack Overflow stackoverflow.com
1 answer

What does `ParseTreeListener` mean in ANTLR?

I read the following statement about ParseTreeListener from the book < The Definitive ANTLR 4 Reference >: ANTLR generates a ParseTreeListener subclass specific to each grammar with enter and ...

1 answers | Dec 15 at 11:31 by smwikipedia on Stack Overflow stackoverflow.com
2 answers

ANTLR4 - what is the reason of prioritizing one rule over another in mode in lexer?

Our setup: parser.g4: absolute_schema_nodeid : (SLASH identifier)+; identifier: IDENTIFIER lexer.g4 tokens{ SLASH } SLASH : '/' ->type(SLASH); IDENTIFIER : [a-zA-Z0-9_][a-zA-Z0-9_\-.]* ...

2 answers | Dec 15 at 10:30 by MartinC on Stack Overflow stackoverflow.com
0 answers

ANTLR4: grammar with runtime matching of number of integers not working correctly

I am trying out a grammar in the ANTLR 4 book (p. 48-9), but the grammar isn't behaving as advertised. The input is a series of integers. One integer indicates the number of following integers. For ...

1 answer

ParseTreeVisitor or ParseTreeListener

I am trying to write an AST interpreter / REPL. ANTLRv4 provides two very similar interfaces (ParseTreeVisitor and ParseTreeListener) to walk the parse tree. I cannot seem to find any major ...

1 answers | Dec 14 at 9:34 by Joshua on Stack Overflow stackoverflow.com
1 answer

The position of <EOF> in ANTLR 4 is kind of strange?

I am trying the ANTLR 4, it gives me the following output for the simple Hello grammar in the book < The Definitive ANTLR 4 Reference >: [@2,12:11='<EOF>',<-1>,2:0] According to the ...

1 answers | Dec 13 at 17:08 by smwikipedia on Stack Overflow stackoverflow.com
5 answers

antlr4-Can't load Hello as lexer or parser

I recently have to use parser to do a project. I download ANTLR4 and follow the steps described in the book The Definitive ANTLR4 Reference. The following are the steps I type in command line: 1. ...

5 answers | Dec 13 at 7:49 by user3162707 on Stack Overflow stackoverflow.com
0 answers

How do you pop modes twice/pop without consuming

This is an example of the input: <span class="hello">cont@(Property)ent</span> And this is an example of my current grammar (simplified; if there are syntax errors it is because of my ...

Dec 12 at 18:50 by Stmated on Stack Overflow stackoverflow.com
2 answers

ANTLRWorks warning 'no start rule'

please help a newbie to understand this warning in ANTLWorks: [11:10:15] warning(138): BooleanExpr.g:0:1: grammar BooleanExpr: no start rule (no rule can obviously be followed by EOF) This is ...

2 answers | Dec 12 at 11:39 by Ihor M. on Stack Overflow stackoverflow.com
2 answers

Using Visitors in AntLR4 in a Simple Integer List Grammar

I'm a newbie in AntLR. I'm using AntLR4 version. I wrote the following attribute grammar that recognizes a list of integers and print the sum of the list at the end. list.g4 grammar list; @header ...

2 answers | Dec 10 at 20:03 by psfdc on Stack Overflow stackoverflow.com
2 answers

ANTLR’s predicated-LL(*) parsing mechanism

I'm building the following grammar: Letter : 'a'..'z'|'A'..'Z' ; Number : '0'..'9' ; Float : Number+ '.' Number+ ; a5 @init { int n = 1; } : ...

1 answer

Joins on Apache Hive 0.14 update and delete queries

I am searching for support of joins on update/delete Hive 0.14 which supports transactional queries, like teradata 15.00 supports the sql queries like DELETE FROM employee WHERE employee.deptno = ...

1 answers | Dec 10 at 16:29 by Abhi on Stack Overflow stackoverflow.com
1 answer

Check similar expressions using ANTLR

I'm new to using ANTLR and I was wondering if there is a way to check similar expressions. For example, how could I validate two expressions that are logically equivalent, such as the following ...

1 answers | Dec 10 at 15:34 by Neelansh Gupta on Stack Overflow stackoverflow.com
0 answers

Antlr rule with parameter

I'm struggle with ANTLR rule parameters. ANTLR version is 4.4. grammar A; DIGIT: [0-9]; s: val EOF; val: dval[1] | val '*' val; dval[int x]: '.'; ANTLR fails with error(50): :2:32: syntax error: ...

15 30 50 per page
1 2 3