Damian Walker

Personal Web Pages

Building a Compiler

I've recently got interested in building my own compiler, for fun. I hope to implement it under Linux and Windows, and I'll use this page to document my progress.

The aim of the language will be simplicity and elegance. The syntax is inspired by BASIC, but the simplicity of the core language is inspired by C. I'll be providing simple console I/O as part of the core language, just so that vaguely useful programs can be written without use of a library. Libraries, if I get around to them, will be modular like in Java.

Program Syntax

24 Nov: I haven't yet settled on a name for my programming language, but I know what its programs will look like. I learned to program in BASIC, and I'm most comfortable with its syntax. Not the ancient form with line numbers and GOTO, but more the structured BASICs like QuickBASIC and OPL. The classic recursive factorial program will look something like this: REM -- recursive factorial function PROCEDURE factorial (n AS INTEGER) AS INTEGER IF n <= 1 RETURN ... (read more...)