Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
81 views

How to extract raw contents (including comments) within braces in specific situations?

I am trying to write an ANTLR4 grammar for the .asl file format (LiveSplit Autosplitting Language). It is a script format with one custom block (state) and several action blocks (startup, init, etc.) ...
Ero's user avatar
  • 101
0 votes
0 answers
26 views

How to improve an antlr no viable alternative error message

I have an antlr grammer for cypher queries and ran into the following invalid case: MATCH (u:person) where (u.firstName = 'foo' RETURN u.id org.cytosm.common.Cypher2SqlException: Syntax error: line 1:...
benleis's user avatar
  • 11
0 votes
0 answers
29 views

ANTLR: Why does my grammar throw NoViableAltException?

I'm not seeing an explanation anywhere for what is triggering this exception. (I added EOF while looking, but it didn't help.) What's going on? (I'm using C# and Antlr.Runtime.Standard from NuGet. Is ...
Grault's user avatar
  • 1,113
0 votes
0 answers
53 views

Reproducible Way to Create an AST from a Parse Tree

For my GameVM project I'm using ANTLR v4 to create multiple compiler frontends. Generating the lexer and parser for each language saved me a ton of work (especially since I have no background in ...
Kenneth Cochran's user avatar
1 vote
0 answers
120 views

How do I resolve these issues with my ANTLR grammar for AutoHotkey code?

I transpile AutoHotkey v2 code to C# using ANTLR4 and Roslyn. An example using only a few grammar elements, described by these rules: Statements start at the start of a line, preceding white spaces ...
Descolada's user avatar
0 votes
1 answer
28 views

Values are not assigned in the visitLiteral, Left: null, Right: null, Operator: <

There is a code of STInterpreter class that then gets the code: package com.jdcs.st; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.tree.*; import java.util.HashMap; import java.util.Map; ...
Eljah's user avatar
  • 5,273
0 votes
1 answer
32 views

ANTLR line 1:12 token recognition error at: '\n'

I have a grammar like that: grammar ST; program: statement+; statement: assignment ';' | ifStatement | whileStatement | forStatement | functionCall ';'; ...
Eljah's user avatar
  • 5,273
1 vote
1 answer
56 views

Issue with parse order in ANTLR4 grammar

Below is a very simplified grammar to illustrate the problem. I likely can handle the existing result in generated code, but suspect there is some more elegant way to instead control the parser. ...
Nils Kronqvist's user avatar
0 votes
2 answers
40 views

How to Restrict return Statements to Function Declarations in ANTLR Grammar?

Question: I'm working on a custom parser using ANTLR to define a small programming language. One of the requirements is that return statements can only appear inside the body of a function. If a ...
hdz1412's user avatar
1 vote
1 answer
67 views

How to enforce using the same production for non-terminal symbol in a rule?

Say I have an ANTLR grammar: program = word (' ' word)* ; word = 'dog' | 'cat' | 'bird' ; As I understand, it will match any sequence of words above, e.g. "dog dog cat", "dog cat ...
Yevgeniy P's user avatar
  • 1,634
2 votes
0 answers
56 views

antlr4 grammar - perf issues, ambiguities, and loads of single-char tokens

I am writing an antl4 grammar for splitting semicolon-separated statements. Below is a minimal version of the grammar. The full grammar has multiple types of comments, strings, identifiers, etc. The ...
Jeff B's user avatar
  • 141
0 votes
1 answer
50 views

Antlr 4 Grammar seems to ignore defined precedence

I'm having an issue with my Antlr 4 grammar, where it seems like its ignoring precedence. For the given expression $(USD)100'2 * -1, I expect it to evaluate $(USD)100'2 first then multiply by -1. So ...
Renaud's user avatar
  • 55
1 vote
0 answers
91 views

ANTLR4: Why is it checking for Full Context?

I need some assistance identifying why this is checking for Full Context in my ANTLR4 Language: Lexer: Here & Parser: Here Shortened Parser with only the semi-relevant pieces: startPlainString: ...
Mercutio's user avatar
1 vote
1 answer
79 views

Multiple problems with ANTLR visitor processing

I am doing a pseudo programming language on ANTLR and Java. I met a few problems I can't deal with: If, else if and else: only one statement is executed per each condition, so others will be skipped. ...
Artem Bachynskyi's user avatar
2 votes
1 answer
61 views

ANTLR4: no viable alternative at input 'stringname'

I am doing my research by making a programming language using antlr4 and I am struggling for whole day to fix the problem with two words being one token after whitespace removal. This is my grammar ...
Artem Bachynskyi's user avatar

15 30 50 per page
1
2 3 4 5
287