A pure, minimalistic programming language.
written in C.
let output = 0
let i = 1
while i < 10 do
let j = 0
while j < 10 do
output = output + j * i
if j == 5 then break
j = j + 1
end
i = i + 1
endfunctions:
let write = function(v)
__write(tostring(v))
let sum = function(x)
if x < 2 then x
else x + sum(x - 1)
write(tostring(sum(3)))
this does the same thing:
let write = function(v)
__write(tostring(v))
write(tostring((function(x) if x < 2 then x else x + @(x - 1))(3)))modules:
import io
io.write(1)io.microl:
let export io = function(val) __write(tostring(val))(beware that currently all modules should be located in ./stdlib/)
$ microl run example.microl
# This will run example.microl
The value printed is the value of the output variable.
token.h- tokens and atoken_list_twhich is a linked list of tokens.lexer.h- defineslexthat will generate a token list from a FILE.ast.h- defines all of the nodes.parser.h- all of the parser functions.ctx.h- defines obj_t and ctx_tintr.h- an interpreter (temporary)main.c- the main file. (cli + running)
- make modules a separate object that can hold a whole context!.
- add parser support for strings.
- add parser support for nil.
- unify object allocation functions.
- change
get != ... then errortopeek != ... then error else del - make this a compiler to custom bytecode
- optimise
-
parse operators other than+and*(simple to fix, but im lazy). -
add if and loops -
change fromdoubleto some kind ofobj_tfor the interpreter. -
add functions. - add stdlib - in progress
-
add modules! -
make object values separate. a simple number takes up a lot of memory!
- Compile to WASM
- Compile to x86
- LLVM for C?
- Other VMs.