henry232323 / beef

A simple attempt at a compiler written in Rust (the compiler part is pending)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compiler

Todo

  • Convert AST to some sort of "bytecode"
  • Eval/exec function to run bytecode
  • Parsing
    • Loops
    • Other operators
    • Import
    • Try/Catch
    • Break keyword
    • Continue keyword
    • Return keyword
    • Pattern matching

Bytecode Spec

Modification
Timestamp
4 bytes
Description
Header Title
Paragraph Text
  • Top level vars
dump   = header proto+ 0U
header = ESC 'L' 'J' versionB flagsU [namelenU nameB*]
proto  = lengthU pdata
pdata  = phead bcinsW* uvdataH* kgc* knum* [debugB*]
phead  = flagsB numparamsB framesizeB numuvB numkgcU numknU numbcU
[debuglenU [firstlineU numlineU]]
kgc    = kgctypeU { ktab | (loU hiU) | (rloU rhiU iloU ihiU) | strB* }
knum   = intU0 | (loU1 hiU)
ktab   = narrayU nhashU karray* khash*
karray = ktabk
khash  = ktabk ktabk
ktabk  = ktabtypeU { intU | (loU hiU) | strB* }

https://github.com/jauhien/iron-kaleidoscope#chapter-2-llvm-ir-code-generation

About

A simple attempt at a compiler written in Rust (the compiler part is pending)


Languages

Language:Rust 100.0%