BorrowScript icon indicating copy to clipboard operation
BorrowScript copied to clipboard

Compiler

Open argoopjmc opened this issue 4 years ago • 6 comments

Have you decided how you want to build the compiler for BorrowScript? I think at this point, we have a basic specification for the language so some of us interested in the project can start coming up with a test suite of valid and invalid source files for the language, along with discussing and setting up the basic infrastructure for the compiler ( parsing and code generation).

I think it would be a great idea to have a Discord/Slack for this project where people can join, discuss and work together on making this project a reality.

argoopjmc avatar Apr 04 '22 20:04 argoopjmc

Great idea, will set up a discord channel to kick things off.

I'm new to writing compilers so it will take me some time to learn things like targeting llvm, etc - but I was planning on starting by writing an AST parser, type checking and borrow checking prior to compilation.

By the time it's done I'll hopefully know enough about llvm to know how to target it, or just go with a less sophisticated approach of code to code compilation to C then use gcc to compile the program.

alshdavid avatar Apr 05 '22 14:04 alshdavid

That sounds like a plan! Let us know when we join and help out.

argoopjmc avatar Apr 05 '22 15:04 argoopjmc

I've been hearing a lot about MLIR lately - I came across this video, which provides a basic overview of MLIR and LLVM. 🙂

mindplay-dk avatar Apr 10 '22 08:04 mindplay-dk

Brainspin: with WASM and WASI growing and maturing, can't we just compile to WebAssembly?

ESchouten avatar May 19 '22 22:05 ESchouten

Yeah, I have been wondering about the same thing. 🤔

Basically, WASM + SIMD + threads = FAST

image

It might be relatively easier to target WASM than LLVM or MLIR?

Although perhaps with SIMD it's now just as hard to generate optimized WASM?

mindplay-dk avatar May 20 '22 12:05 mindplay-dk

Sorry I keep dropping off on this project - I have been going away studying how I could approach it. I have spent some time learning LLVM IR and I think it's entirely rational to target LLVM from the get go (rather than my previously proposed BS -> C++ transpiler).

A lot of the language syntax makes sense except the way lifetimes are designed and there is nothing on how "unsafe" will be applied syntactically.

That said, it doesn't stop the ability for me to start writing some of the more basic features, like a hello world application.

Once the language compiler starts moving forward, there will be the big task of the standard library and tooling.

alshdavid avatar Jul 15 '22 02:07 alshdavid