Skip to content

Num0Programmer/alang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Arithmetic Language (alang)

Simple language for evaluating expressions. Features: (1) Addition (2) Subtraction (3) Multiplication (4) Division

NOTE: the above operations can only be carried out on integers of size 'word'

Installation

Please be sure you have a C compiler installed on your system. On linux, this can be obtained through your distribution's package manager. On MacOS, this can be installed through Homebrew. If you're on Windows, good luck sucker.

QBE

To be able to compile your programs, you will need to install QBE compiler to compile the QBE Intermediate Representation (IR).

Bootstrapping Alang from Source

Once you are able to compiler C and QBE IR, you can now compiler the Alang compiler simply by doing the following:

git clone https://github.com/Num0Programmer/alang.git
cd alang
make

Compiling

Now that the compiler is built, you can compile and run your own Alang programs. For a reference, check out examples in the 'examples/' directory. Try building and running the addition example by running the following:

./alc examples/add.a add.qbe
qbe add.qbe -o add.s
cc add.s -o add
./add

The result should be:

19

Technologies

[1] QBE Compiler Backend

About

A simple arithmetic language for performing mathematic operations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published