lua-users home
lua-l archive

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


On Tue, 10 Mar 2020 at 21:15, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
> In case it wasn't clear - I have already got a lexer and a parser. I
> am trying to expose this to users, example a way for users to traverse
> the AST. I have looked at how Clang does it, and Go does it -  I am
> leaning more towards a Visitor pattern so that the AST itself doesn't
> need to be exposed.

It seems that it is unclear what I am looking to do, so here is the
current api state.
Right now I have exposed the lexer which is pretty much based on Lua's lexer.
The api allows you submit a Lua source, iterate through the tokens
until the input is exhausted.
The api gives you everything you need hopefully.

You can also see the parser api but it doesn't expose the AST -
abstract syntax tree or provide a way to traverse this - at the
moment.

https://github.com/dibyendumajumdar/ravi-compiler/blob/master/include/ravi_compiler.h

Regards