winget install EclipseAdoptium.Temurin.21.JDK
Search for antlr, and install ANTLR4 grammar syntax support. Then, I suggest pressing F1, choosing “Preferences: Open User Settings (JSON)”, and adding the following setting inside the curly brackets:
"antlr4.generation": {
"mode": "none"
}
That will prevent the VSCode ANTLR extension from generating Java code into your project in an inappropriately named .antlr folder.
Copy the examples/lexer project from the class files (see Resources) to your computer.
In VSCode, choose File > Open Folder, and choose the lexer folder. Use Terminal > New Terminal to access a command prompt. Build the project using gradlew build install (Mac/Linux users must make gradlew executable and execute ./gradlew build install). This command compiles the project and runs the unit test. There should be no errors.
Locate the script build\install\lexer\bin\lexer and use it to run the lexer. Use the sample data file math.txt as a test input file.
You can use VSCode to run the lexer. Choose Run > Open Configurations to open the .vscode/launch.json file that contains run configurations for your project. Copy and paste the example launch.json file below. Then, choose Run > Run without debugging. You should be prompted for command line arguments. Enter math.txt to run the lexer with that file as its argument.
You should be able to make changes to any Java file or the grammar and then run again. VScode will automatically rebuild the project. If it doesn’t for some reason, try deleting the build folder containing the compiled artifacts, then press F1 and enter Java: Rebuild Projects to force a rebuild.
At this point, you are ready to begin work on Phase 1.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Main",
"request": "launch",
"mainClass": "cps450.Main",
"args": "${command:SpecifyProgramArgs}"
}
]
}