Skip to content

Getting Started

Andrew Johnson edited this page May 28, 2024 · 14 revisions

Requirements

The compiler currently depends on x86-64 Linux system calls: sys_open, sys_close, sys_read, sys_write, sys_exit, sys_brk.

Installation

Download the source. Compile and install it.

git clone https://github.com/andrew-johnson-4/lambda-mountain.git
cd lambda-mountain
sudo make install

Hello World

In a file hello_world.lm put a main function

import LIB/default-instruction-set.lm;
import LIB/default-primitives.lm;
import LIB/default-stdlib.lm;
import LIB/default-rules.lm;

main := λ.(
   print 'hello_world_s
);

Compile hello_world from a shell

lm -o hello_world.s hello_world.lm
as -o hello_world.o hello_world.s
ld -o hello_world   hello_world.o

Run the result

./hello_world
[stdout] hello_world