Khichu is experimental programming language that targets WASM and a custom register-based VM (TODO). We do our own code-generation from scratch instead of relying on LLVM or similar code-generation technologies.
This is project done during free time.
Write the code in test.ul
and do:
# Zig 0.13
zig build run
- Add some tests running facility
- Check if code-gen for assignment statement/expression is good or not.
- Find some way to collect as many as errors possible before quitting.
- Allow 'var x = 5;', that is allow type inference.
- Analyzer
- Check if the identifier used already exists or not.
- Turn symbol table into hashmap.
- While reporting error, show where previous identifier is declared.
- Maybe do this in semantic analyzer?
- Disallow variable shadowing.
- Disallow changing type on assignment to same variable (if var is float, then it is legal right now to assign bool to it, but it should be illegal).
- Check if the identifier used already exists or not.
- Minor refactor:
- Code is bit stinky
- What should be better error message?
test.ul:0: Expected ';' after 'expression', found 'identifier'.
x: float = 8.2 + 2.1 / 3.8;
^--------------------------
- Add functions, conditioanls and loops
- Add data types such as different signedness of integer with different size, arrays, etc.
- Remove hardcoding of some of wasm code-gen
var x: float = 5;
interpret 5 as integer, so generated wasm code assignmet doesn't work.
- Start Register-Based VM
- Suggest related variable names, for example, programmer types
x_ids
but onlyx_idx
exist, so it will suggestx_idx
.
- Be able to parse all the basics feature a programming language can have. (functions, arrays, loops, etc)
- Write WASM code gen for it
- Design custom IR
- Use this IR to codegen WASM code
- Design register-based VM and it's bytecode.
- Do optimization on custom IR to produce efficient builds.
- Maybe do RISC-V codegen