mirror of
https://github.com/bearlanguageorg/bear.git
synced 2026-08-26 14:57:18 +00:00
18 lines
364 B
V
18 lines
364 B
V
// compiler.v — public API for the VuurRaaf compiler.
|
|
module compiler
|
|
|
|
import os
|
|
import obj
|
|
|
|
// compile parses and compiles VuurRaaf source into an object file.
|
|
pub fn compile(src string) !obj.Obj {
|
|
toks := tokenize(src)!
|
|
prog := parse(toks)!
|
|
return gen(prog)
|
|
}
|
|
|
|
pub fn compile_file(path string) !obj.Obj {
|
|
src := os.read_file(path)!
|
|
return compile(src)!
|
|
}
|