sustainably

Java for ARM

GitHub
C
C++
Lex
Yacc
A from-scratch compiler built to support a subset of Java for ARM.

Description

As a project from CS 352, I was tasked to create a from-scratch compiler levying variants of top-down and bottom-up parsing for syntax recognition and error handling, construction of an abstract syntax tree with compile-time typechecking, and lastly, code generation for ARM assembly.

Subset

As noted prior, my compiler only supports a specified subset of modern Java. The extended BNF grammar rules can be found at the link below.

Grammar

Creating a Compiler

While the general approach to building a compiler follows the steps of syntax, typechecking, codegen, and optimization, I took a few different with each step. Syntax-checking came in the form of first, top-down parsing with just Lex, followed by an implementation of bottom-up parsing with the use of Lex and Yacc. This approach was taken to get an underlying understanding of parsing before using a tool like Yacc. Next, with typechecking, I incorporated grammar semantics with my previously defined grammar, building an abstract syntax tree (AST) that supporting scope and symbol table entries. Finally, for the timebeing, came code generation, where I took a two-step approach of using 3AC instructions in the first pass of the AST, finally parsing to ARM assembly with the allocation of stack offsets and registers. Currently, I'm focusing on scalability of code generation with changes in instruction sets, alongside register and stack optimizations.

Output

Key Takeaways

This easily became one of my proudest projects I've worked on. Rather than taking an abstracted view of processes behind modern languages, the project used low-level approaches to solve to the problems at hand -- further reenforcing my interest in gathering a deeper understanding of existing problems and their solutions.

Sustainably

Sustainably

A wellness-driven startup with an aim to help those on their fitness journey.

Java for ARM

Java for ARM

A from-scratch compiler for a subset of Java for ARM.

Sociable

Sociable

A platform for students to explore what's active on their campus.

Traffic Deep RL

Traffic Deep RL

A project aimed at optimizing traffic-light patterns.

Traveling Merchant

Traveling Merchant

A hub for any sales gone virtual.

ZooKeep

ZooKeep

An experimental project, seeking to test the integrations of information systems.

Loan Default Prediction

Loan Default Prediction

An ML investigation on the defaulting of loans.

Communicode

Communicode

A startup with an aim of connecting developers with non-profits.

Nicholas Dullam

Senior Software Engineer