https://github.com/aymenkhs/compiler-with-antlr
A compiler using antlr4 and JAVA
https://github.com/aymenkhs/compiler-with-antlr
antlr4 compiler java lexer parser
Last synced: 13 days ago
JSON representation
A compiler using antlr4 and JAVA
- Host: GitHub
- URL: https://github.com/aymenkhs/compiler-with-antlr
- Owner: aymenkhs
- Created: 2021-03-02T23:31:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-16T15:49:41.000Z (almost 5 years ago)
- Last Synced: 2025-12-02T17:05:17.993Z (7 months ago)
- Topics: antlr4, compiler, java, lexer, parser
- Language: Java
- Homepage:
- Size: 161 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a small compiler in java that uses ANTLR as a lexer and parser
After parsing our grammar we check lexical errors, generate Quadruples, and then assembly code using the visitor class to walk our tree
# Depencencies
* install JAVA
* download ANTLR (you can download it [here](https://www.antlr.org/download.html)) and add it to your project
# HOW TO RUN IT
## Generate the ANTLR Graph
You can generate the ANTLR graph from the file grammar/tiny_parser.g4
## Run the rest of the project
You can simply run the class "Launch.java" that execute the compiler on a test file.
# Project Structure
* The Lexer and Parser rules are defined in the grammar package
* The generated files package contains the ANTLR generated files