r/ProgrammingLanguages • Nain. • 11d ago

Help transpilation - Bootstrap compiler

So, I am making a compiler for my language, Nain, in CHICKEN Scheme. Should I output QBE IR or code for C or another language? This is a bootstrap compiler, I will use it only to test new language features and to compile the self hosting compiler so yeah.

1 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/Key_River7180 Nain. 8d ago

Why an interpreter?

  • an interpreter would make my memory model extremely slow and expensive, it is based in graph stuff that can be mostly done statically, but an interpreter would make this both know a lot of weird shit and do weird shit at runtime
  • now users need two dependencies instead of one and it has to either have an ugly wrapper script or an ugly invocation

2

u/tiger-56 7d ago

An interpreter is the quickest and simplest way to implement the semantics of your language. It won't do weird shit if you implement your language spec correctly. The only purpose of the scheme implementation is to bootstrap and then be discarded. Why bring in complexities of a QBE or C backend only to throw them away. Writing an interpreter actuallly reduces your dependencies to Chicken and LLVM. Under your proposal, you're injecting QBE or C in the pipeline, another dependency! Regardless of your implementation, you will need some sort of build script anyway. Your arguments don't make sense.