This is a compiler for PINS22 programming language as defined in this specification.
To compile and run a pins24 program, you must clone this repository and run:
./pins24 ./path-to-my-source-program.pins24
You can check out the ./examples directory for some example pins24 programs.
fun main() =
putstr("Hello World\n\00")
fun main() =
let
var x = 10
in
x = inc(x),
x
end
fun inc(n) = n + 1
var x = 20
fun main() =
while x > 0 do
putint(x),
if x % 2 == 0 then
putstr(" is even\n\00")
else
putstr(" is odd\n\00")
end,
x = x - 1
end,
0
Exits the program with the specified exit code.
Returns the integer read from the standard input.
Prints the integer to standard input.
Writes the string from standard input to the specified address.
Writes the string from specified address to standard output.
Reserves the specified amount of space on the heap.
Frees up reserved memory space at the specified address on the heap.
Note: This technically does nothing, due to our simplified heap implementation.
Appends the string at the source address to the string at the destination address.
The destination must have enough memory allocated for both strings.
Writes count
repetitions of character char
to the destination string memory address.
Concatenates provided strings at the destination string memory address.
Returns the length of the string at the specified memory address.
Copies the string from source memory address to the destination memory address.
The destination memory address must have enough allocated memory for the whole source string length.