Isaac Hung
Designing and Implementing a Programming Language

Designing and Implementing a Programming Language

September 22, 2021 — Present

Programming languages are the foundation of the software engineering world. Over the last few years, I've been driven by my curiosity to research into how these languages work, designing and implementing my own language.


Introduction

Structure of a compiler

Programming languages serve as the bridge between human logic and machine execution, shaping how we interact with technology. This project is rooted in my fascination with language theory, design, and implementation, which I’ve pursued since high school. My journey began with crafting interpreters and compilers based on insights from foundational texts like Crafting Interpreters by Robert Nystrom. Through this project, I aim to create a fully-featured programming language that balances power with accessibility, democratizing technology for all users.

The language is designed with the needs of both beginners and experienced developers in mind, incorporating features that enhance productivity while minimizing the barriers to entry. My current implementation is based in Rust and leverages advanced concepts like the Hindley-Milner type system and LLVM for performance optimization.

Current progress

As of now, I have successfully implemented several interpreters for simple programming languages, featuring basic arithmetic operations, control flow mechanisms, functions, and classes.

Language design

The core components of my new language design are underway, focusing on a minimalist architecture that allows for future expansion without compromising simplicity.

I have also developed a preliminary compiler that translates the language into an intermediate representation, utilizing LLVM for further optimization.

Architecture

Some significant milestones I have achieved are:

  • Language design: established the core syntax and semantics
  • Interpreter development: completed multiple interpreters for prototype languages
  • Compiler infrastructure: initial stages of the compiler built, including:
    • parsing
    • AST generation
    • name resolution
    • module system
    • import resolution
    • type checking

Syntax analysis Syntax analysis framework

Error diagnostics User-friendly error diagnostics

Despite these achievements, the project is ongoing, with various features and optimizations still to be implemented.

Next steps

The immediate focus will be on completing the compiler’s implementation. Key areas of work include:

  1. Feature integration: adding advanced language features like generics and error handling
  2. Testing framework: finalizing a robust testing suite, including snapshot testing for dynamic verification
  3. Performance optimization: leveraging LLVM to enhance execution speed and efficiency
  4. Documentation: creating comprehensive documentation to aid users and developers

In parallel, I aim to engage with the programming languages community for feedback and collaboration, enhancing the project’s design and implementation through diverse perspectives.

Future visions

Looking ahead, I envision this project evolving into a production-ready programming language that not only meets the practical needs of developers but also serves as an educational tool. My goals include:

  • Community Engagement: Building a supportive community around the language, fostering collaboration and knowledge sharing.
  • Real-World Applications: Identifying specific domains where the language can excel, such as data science or web development.
  • Research Contributions: Conducting studies to evaluate the language’s impact on developer productivity and code quality, contributing to the academic discourse on programming languages.

Ultimately, I aspire for this language to become a viable alternative in the landscape of programming languages, filling gaps that currently exist and pushing the boundaries of what is possible in software development.

Posts

Since I’ve been working on this project since Grade 9, I’ve written a few blog posts on the project: