Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project_LexerBase.js missing from generated files #4795

Open
CarbonMan opened this issue Mar 10, 2025 · 1 comment
Open

project_LexerBase.js missing from generated files #4795

CarbonMan opened this issue Mar 10, 2025 · 1 comment

Comments

@CarbonMan
Copy link

Hi,
When I run
java org.antlr.v4.Tool -Dlanguage=JavaScript PythonParser.g4

PythonLexer.js is generated, however, it has the line

import PythonLexerBase from './PythonLexerBase.js';

but PythonLexerBase.js does not exist

I am using antlr-4.13.2-complete.jar

@kaby76
Copy link
Contributor

kaby76 commented Mar 10, 2025

Antlr4 does not generate base class files. These are written by hand per grammar to implement the Antlr "actions" referenced in the .g4's. You are referring to one of the grammars in https://github.com/antlr/grammars-v4/tree/master/python. Please find the grammar you are using, then look for a "JavaScript/" sub-directory (ever port has a sub-directory named after the port/target) under the grammar you are using. There is the .js file. Copy the file along with all other files in JavaScript/ to the same directory where the .g4's are. If there is a "transformGrammar.py", run "python transformGrammar.py" prior to running the antlr4 tool command (fix-ups may be required for the .g4 for JavaScript).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants