Skip to main content
1 vote
1 answer
51 views

I'm currently trying to parse a custom configuration format using ANTLR4. Here is what the input may look like (in reality it's a lot more technical, but I had to change it for SO bc I want to keep my ...
Haikun's user avatar
  • 11
1 vote
0 answers
75 views

Let me give you an example. In a language like Java, we have code like this: class className { } In this example, if className is concatenated to class, and also className is concatenated to {, how ...
Developer's user avatar
1 vote
1 answer
85 views

I’m working on a custom Javadoc lexer in ANTLR 4, and I’m trying to handle special mode switching when I reach the start of a line. I have a simplified example like this: mode START_OF_LINE; ...
mohamed mahfouz's user avatar
2 votes
1 answer
96 views

I'm trying to capture the optional type hints that come after parameter names for my own toy language so I can make them a different color, I'm using a tmLanguage.json file to create the synatx ...
buzzbuzz20xx's user avatar
0 votes
1 answer
58 views

Let's assume I have a given ANTLR parser assembly with many Parser and Lexer classes contained within. Is there a programmatic way to determine which of the lexer classes a given parser class ...
WiredWiz's user avatar
  • 690
0 votes
1 answer
75 views

when there is no separation between fractions, and the lexer merges it all into one token → unknown to the FRACTION token: 2|1+4|15|2-18|5 line 1:11 no viable alternative at input '2|1+4|15|2-18|5' 2|...
Saruman's user avatar
0 votes
1 answer
51 views

When building the DFA for the lexer of my programming language, should each character (e.g., n, i, f) appear as a single shared node across all token paths, or should I allow duplicate nodes for the ...
AdirMor's user avatar
  • 35
0 votes
1 answer
50 views

I am parsing an old language (PL/I) that uses single quotes for strings, and allows embedded single quotes as "two single" quotes for instance: 'This is a normal string' 'This contains '' ...
Andrew Clark's user avatar
-1 votes
1 answer
92 views

I'm working on a simple Pascal-like interpreter using PLY, but I'm encountering a Syntax error at ',' during parsing. The issue arises when trying to parse a source file that includes commas. Below is ...
Juju's user avatar
  • 1
1 vote
1 answer
86 views

What's the difference between the token _123jh and 123jh that makes most lexers not include a number-starting identifier? I suppose one reason might be that a number-only token might be confusing, and ...
David542's user avatar
  • 112k
-1 votes
1 answer
164 views

Preamble I am creating my own JSON lexer and eventually a full parser, purely as a learning experience because that is what I enjoy doing. As I understand it, the lexer's job is to tokenize the data (...
Jake Perry's user avatar
0 votes
1 answer
26 views

In the following example, the input token 'AX' seems to cause errors for an unknown reason. The parse tree shows that other rule matches that contain register tokens such as 'DX' are working fine. I'...
Scooteroy's user avatar
1 vote
1 answer
52 views

I want to build a little lexer and parser by myself. I want the lexer to produce a vector of tokens that I feed into the parser later. Now I think about what belongs into which stage. Let's look at ...
MrSnrub's user avatar
  • 1,265
0 votes
0 answers
57 views

I’m working on a DFA-based lexer using regex derivatives for tokenizing lexemes. I've built a setup that, theoretically, should handle regex simplification and DFA transitions accurately. For the most ...
Jacques's user avatar
  • 51
1 vote
0 answers
40 views

I am making a lexer & parser for a 8 bit cpu, my lexer is working fine but when I added AST class for parse, this problem started. Whats the problem and how to solve it The code takes a string ...
Pratik S's user avatar

15 30 50 per page
1
2 3 4 5
74