lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

The below project is coming along slowly - it is now possible to
generate code for most of the language syntax, although  not much work
has been done yet in the optimization stage.

Right now the code is in C. I wanted to get some views on what
language is best suited if I want this to become a compiler library
for students and instructors to play with?
Is it better to use C++ ? I was thinking of Rust too but Rust is a
pretty difficult language to get into.

Since the idea is to also make the library usable in the real world, I
prefer to keep it in compiled language, and ideally with zero runtime
support. This rules out some languages such as Go which have GC and a
runtime.

Regards
Dibyendu


On Fri, 21 Feb 2020 at 21:55, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>
> Lua's inbuilt parser and code generator is a work of art, very compact
> and low overhead but extremely fast. It uses minimal memory and
> produces bytecodes as it parses the source code (single pass
> compiler). This is great for Lua and Ravi given the use cases of these
> languages, but makes the parser and code generator quite hard to
> understand, play with, or reuse in tools such as IDEs. It also makes
> it harder to perform any advanced type checking or performance
> optimizations.
>
> I am pleased to announce a new project to create a Lua/Ravi parser and
> code generator that is not a replacement for the default one in
> Lua/Ravi but can be used for more specialised code generation, as well
> as as a means of understanding how the parser and code generator
> works. My hope is that it will enable the study of Lua implementation
> in educational institutions, as I intend to use classical methods of
> compilation. Moreover, ease of maintenance is a bigger priority than
> sheer memory or performance efficiency.
>
> The project was initially part of Ravi because I was reusing the Lua
> lexer. However, I have now split this off into a standalone project
> independent of Ravi.
>
> The project is currently under development. You can view the code at:
>
> https://github.com/dibyendumajumdar/ravi-compiler
>
> All feedback and contributions welcome!
>
> Regards
> Dibyendu