A baseline project for "Design Compilers for DSL" course
Python example for ANTLR can be found here
- Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Install antlr4 tool
brew install antlr - Create python virtual environment
- Install antlr4 python interface
pip install -r requirements.txt
- Install WSL and Ubuntu distro
- How to turn on Hyper Visor video
- Move WSL installation to non-system drive
wsl --manage distro --move new-locationwheredistro = Ubuntuandnew-location = D:\wsl\ - How to reset user password
- Start Ubuntu terminal in as root user
wsl -d Ubuntu -u root - Reset password for your user
passwd {username} - Enter new password and confirm it. Note: in Unix like systems passwords typed in terminal are not visible
- Start Ubuntu terminal in as root user
- Install VS Code and recommended for this project extentions
- Install WSL extention for VS Code
- In bottom left corner select Open a Remote Window button and restart VS Code in WSL mode
- Run Ubuntu terminal from start menu or in VS Code
- Update system packages
sudo apt update && sudo apt upgrade -y - Install python3
sudo apt install python3 python3-pip python3-venv - Install antlr4
sudo apt install antlr4
- Install python3 from official website without Admin Privileges and/or adding to Path
- Install VS Code and recommended for this project extentions
- In VS Code open any file with .py extention and in bottom right corner select correct python interpreter installed on previous step
- Run file with Run button in right top corner
- If needed specify default Terminal application by pressing F1, typing Terminal: Select Default Profile and choosing Command Prompt (cmd.exe)
- Install ANTLR4
- Install ANTLR4 with
pip install antlr4-tools - (Alternatively) Get Java for Windows and add java executables & ANTLR4 jar in PATH variable
- Install ANTLR4 with
- Enter folder
cd antlr4_calculator - Run antlr tool
antlr -Dlanguage=Python3 -visitor Expr.g4 - Execute
Driver.pyscript- CLI command
python3 Driver.py --file input.txt --worker visitor
- VS Code Run & Debug config
ANTLR Calculator Example
Run unit tests from VS Code Testing tab
- Run on config form VS Code Run & Debug tab
Naive SubstringKMP Substring