Skip to content

A toy compiler for a toy JVM-based programming language - the ZCode programming language

Notifications You must be signed in to change notification settings

dpnam2112/Zcode-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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! :)

About

A toy compiler for a toy JVM-based programming language - the ZCode programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published