[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Development announcement - Ravi/Lua Compiler project
- From: Dibyendu Majumdar <mobile@...>
- Date: Mon, 22 Jun 2020 00:31:12 +0100
Hi,
In the following location, you can see some of the control flow graph
output from the Ravi/Lua compiler project.
These outputs represent the initial state of the intermediate code.
They are mainly for my benefit to help me debug issues (you will see
some of the generated IR is kind of strange).
https://github.com/dibyendumajumdar/ravi-compiler/tree/master/docs/cfg
I have started to work on analysis passes that will hopefully start to
improve the intermediate IR. Recently I did some work on Dominator
Tree generation. I will be working on Data Flow Analysis next.
I hope this project is of interest to folks that want to use Lua as a
target language in compiler courses. My goal is to create a reusable
library that is helpful for people who want to learn this type of
stuff.
Regards
Dibyendu
On Sat, 2 May 2020 at 13:22, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
>
> Hi,
>
> I am pleased to say that there is now a public API defined for the
> following components:
>
> a) Lexer
> b) Parser
> c) AST walking
>
> You can view the API definitions at
> https://github.com/dibyendumajumdar/ravi-compiler/blob/master/include/ravi_compiler.h
> I decided to create a relatively lower level AST walking api - it is a
> bit verbose but it is an attempt to make the use of the API intuitive
> and safe.
>
> You can see an example of the AST walking api usage here:
> https://github.com/dibyendumajumdar/ravi-compiler/blob/master/tests/tastwalk.c
>
> I will have more details regarding the linear IR generator later but
> for now as it is work in progress. The IR is more like standard
> compiler IR rather then the Lua bytecode IR. If you are curious, you
> can view examples of linear IR output here (note the output contains
> AST dumps as well).
> https://github.com/dibyendumajumdar/ravi-compiler/blob/master/tests/expected/results.expected
>
> I welcome any feedback.
>
> 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