Skip to main content

Questions tagged [antlr4]

Version 4 of ANother Tool for Language Recognition (ANTLR), a flexible lexer/parser generator. ANTLR4 features an enhanced adaptive LL(*) parsing algorithm, that improves on the simpler LL(*) algorithm used in ANTLR3.

antlr4
1 vote
1 answer
40 views

How to express a "call form" expr syntax like 'func arg arg' in Antlr4?

Consider my simple grammar, skipping the lexer here: expr: expr expr+ # CallFormExpr // ⬅ the question here! | L_PAREN expr R_PAREN # ParensExpr | ...
meta_leap's user avatar
  • 2,175
1 vote
1 answer
28 views

How to exclude specific characters from a `\p{..}` unicode set in an Antlr4 Lexer?

In the language I'm grammaring here, I want to allow custom operator definitions whose identifiers fall into the Unicode categories S,P,Me (symbols, punctuations, enclosing-marks) but exclude the ...
meta_leap's user avatar
  • 2,175
0 votes
0 answers
29 views

antlr case insensitivity is being ignored [duplicate]

For some reason the letter fragments defined in a case-insensitive manner are still case-sensitive: grammar filter; query: expression? EOF; expression : field ...
Marcel's user avatar
  • 1,536
0 votes
0 answers
46 views

How to solve parsing of a grammar with ambigous syntax, parser matches more than one rule

I'm trying to write a parser for a maxscript that has several ambiguous statements. Example grammar: program: expr* EOF ; expr: simple_expr | case_expr ; // fn_call must be first, if not, the ...
Atelier Bump's user avatar
0 votes
0 answers
13 views

Contextual awareness for Auto Completion using antlr4-c3 [SQL] [duplicate]

I am trying to write Auto-completion for SQL-Queries. I want to recommend contextual Tables. The query might be: Select from test with the caret being between select and from. I would like to only ...
Thorben Schweizer's user avatar
1 vote
0 answers
27 views

How does Antlr4 support both integers and decimals in terms of lexicon? [duplicate]

I wrote a case study that can perform conventional mathematical operations on integers and decimals grammar Calculation; calculation: expr EOF; // Parser rules expr: expr (ADD|SUB) expr | expr (...
Apollo Elon's user avatar
0 votes
1 answer
23 views

How can I get the the unrecognized Token in an ANTLRErrorListener for a Lexer?

I have a lexer, generated with ANTLR. What I try to achive is to handle an error during lexing in case of an not recognized token. How can I get only the character causing this error? lexer....
Oliver's user avatar
  • 4,019
0 votes
1 answer
63 views

Parsing an array with specific amount of elements

I've recently tried to parse an array with a fixed size in antlr4: array[int size] : {size > 0}? thing array[$size - 1] | ; This allows me to have arrays with a size determined by my ...
SporkWarrior21's user avatar
1 vote
1 answer
84 views

How to build the antlr grammar provided?

I would like to build a cpp parser using cpp and I'm using ANTLR4. I notice there is this 'grammar' section from the official github antlr grammar github and I've downloaded it. While opening the CPP ...
EggDi's user avatar
  • 13
0 votes
1 answer
41 views

Antlr grammars that generate actual class inheritance

Need to know, is it possible to generate parsers, lexers, listeners, etc, by importing subset-grammars? I see that the supergrammar subgrammar pattern is possible, but I'm not sure I see a true class ...
Michael W. Powell's user avatar
3 votes
1 answer
47 views

How to resolve the mistmatched input 'token' expecting 'LEXER_RULE'

I have the following grammar defined in ANTLR4 (g4): grammar SimpleExpr2; expr: entityName '(' paramList ')' SEMICOLON; entityName: ENTITY_NAME; paramList: param (SEPARATOR param)*; param: ...
Cristian Jacob Jimenez's user avatar
0 votes
1 answer
35 views

ANTLR4 GUI parse tree visualisator indefinitely runs without throwing an exception nor producing results

I tried to run the ANTLR4 visualization interpreter from this class with the example grammar description and program code from the antlr4-tools. However with the latest antlr4 release (4.13.1) it runs ...
bcherry's user avatar
1 vote
0 answers
43 views

Extracting SQL JOIN condition column names not working with Antlr using Python

The code below is my attempt to identify join relationships between tables in a Oracle database. The idea is to build a map of joins to help identify implicit FK relationships. In the code below I use ...
TenG's user avatar
  • 3,984
0 votes
0 answers
116 views

Issues Parsing format Statements with Labels in Fortran 2023 Grammar Using ANTLR4

I have developed a Fortran 2023 grammar using ANTLR4, and the grammar is available on my GitHub repository. While parsing the code, I encounter an issue with Format statements. According to the ...
Akhil Akkapelli's user avatar
0 votes
1 answer
41 views

command not found: antlr4ng

I am trying to generate a parser using antlr4ng. I've already installed antlr4ng and antlr4ng-cli using npm install antlr4ng and npm install antlr4ng-cli. But when trying to execute antlr4ng -...
Thorben Schweizer's user avatar

15 30 50 per page
1
2 3 4 5
268