Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 1.4 KB

README.md

File metadata and controls

42 lines (26 loc) · 1.4 KB

Zcode compiler

Introduction

At Ho Chi Minh University of Technology, we computer science students have a required course called "Principles of programming languages" (or PPL for short). This course teaches us about programming language design and implementations. In this course, we are required to write a simple compiler for a simple, JVM-based programming language named 'Zcode'.

The implementation process is divided into 4 phases corresponding to to 4 assignments:

  • Scanning, Parsing: In this phase, we are required to write a parser to check if syntax of the input program is valid.

  • Abstract Syntax Tree (AST) generation: Create the abstract syntax tree from the parse tree generated by the parser.

  • Static checking: Using the generated AST, detect semantic errors occurred in the program.

  • Code generation: The compiler uses the AST to generate JVM bytecodes.

This repository is used to store assignment details and my solution of each assignment.

Requirements

Python 3

How to run

Download ANTLR v4.9.2 and put it in the project directory: https://www.antlr.org/download.html

On Linux/Unix

source ./install_pkg.sh # create virtual environment and install all required Python packages
source ./init.sh        # initialize environment variables

On Windows

How to test

cd src
make test

I haven't built the CLI for this compiler yet, but I will do it soon! :)