Skip to content

Moving my toy pl KarolaScript on LLVM and MLIR infrastructure.

License

Notifications You must be signed in to change notification settings

realbugdigger/KarolaScriptLLVM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

KarolaScript on LLVM (project in progress)

The initial idea was to make "tree-walking code generation"; so source code goes through lexer and parser and finally ends up in AST.

That AST will be walked and LLVM IR would be generated during walk. Look in middleware/llvm-gen for these files.

.ks file --> AST --> LLVM IR --> assembly
          ^       ^           ^
        parser  lowering   backend (llc)

While working on that I found about something called MLIR.

The framework built for language hackers which can be used for sequential lowering.

It will help us when writing language specific optimizations.

Usefull resorces while on LLVM and MLIR journey:


Notes to self:

  • from test.ll (IR code) to test.bc (Machine-level bitcode) use llvm-as. llvm-dis can be used for dissasembling.
To get the final executable from .ll:
  1. Compile LLVM IR to bitcode:
llvm-as yourfile.ll -o yourfile.bc
  1. Compile bitcode to native assembly:
llc yourfile.bc -o yourfile.s
  1. Link the assembly to an executable:
clang yourfile.s -o yourfile

About

Moving my toy pl KarolaScript on LLVM and MLIR infrastructure.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published