lua-users home
lua-l archive

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


I haven't posted here before. I'm the lead developer of the Congo Parser Generator project. Congo, in its origins, is actually a full rewrite of the ancient JavaCC, developed at Sun Microsystems in the 90's. So the parser that it generates is in Java. There is also the ability to generate parsers in Python and C#, but that is currently less complete/polished than the Java code generation.

Anyway, the reason I'm writing this note is to tell you that there is a Lua grammar for Congo available. I wrote a longer announcement on the Congo discussion forum. If you like reading, you can read that. Or alternatively, if you're more into immediate gratification and want to play with the thing directly, just do:

     git clone congo
     cd congo/examples/lua
     ant test

At that point, you can also experiment with:

     java LuaParse <filename or directory>

If you just pass it a single Lua source file, it shows you the parse tree that is built. That is the parse tree that you have access to programmatically if you use the parser in your code. It builds the tree and you can traverse the tree, either imperatively or with a visitor pattern...

N.B. All the above assumes that you have a JDK (>=8) and ant, which is a common make/build in the java tool. If you don't have ant (why would you?), you can do:

    sudo apt install ant

on any Debian/Ubuntu derived Linux. (I think it's yum instead of apt on some other linuxes, like Red Hat.) Or on the mac:

   brew install ant

Most probably, if you don't even have the JDK, when you use one of the above to install ant, it will install a JDK if it can't find one. (As for Windows, I guess you'll have to figure it out...) Oh, another possibility is to use SDKMAN which has the advantage that it installs the stuff in your home directory so you don't need sudo privileges. Also, that works apparently on Windows, though you need to have GIT BASH installed.

Well, I guess that's enough said for now. I hope some people find this useful or interesting at least. All feedback is welcome, either here or on the Congo discussion forum.

Greetings and Best Regards from Spain,

Jonathan Revusky