Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lua Development Tools » Sample code used in LDT to generate AST(how to generate ast in ldt)
Sample code used in LDT to generate AST [message #1219040] Sat, 30 November 2013 03:14 Go to next message
coco peng is currently offline coco pengFriend
Messages: 2
Registered: November 2013
Junior Member
Hi
I have just downloaded LDT and want to develop a lua obfuscator in java based Eclipse.
How can I use LDT to parse a lua source file in java ? I want to create the AST.Is there any sample code I can learn from?

Thanks in advance.
Re: Sample code used in LDT to generate AST [message #1219222 is a reply to message #1219040] Mon, 02 December 2013 17:06 Go to previous message
Marc Aubry is currently offline Marc AubryFriend
Messages: 83
Registered: August 2012
Member
Hi coco peng,

There are no ready to use solution to use build an Lua AST in java, but here some pointors:

The ast is created using metalua:
documentation : https://github.com/fab13n/metalua/blob/master/doc/manual/metalua-manual.pdf
source code : http://git.eclipse.org/c/koneki/org.eclipse.koneki.metalua.git/

Here an example of how we use metalua from Lua in LDT:
https://github.com/eclipse/koneki.ldt/blob/master/libraries/luaformatter/luaformatter.lua

To call lua files from a java code, we use JNLua
project: http://code.google.com/p/jnlua/

Here an example on how we call Metalua using JNLua in LDT:
https://github.com/eclipse/koneki.ldt/blob/master/plugins/org.eclipse.koneki.ldt.metalua/src/org/eclipse/koneki/ldt/metalua/AbstractMetaLuaModule.java
The super class: https://github.com/eclipse/koneki.ldt/blob/master/plugins/com.naef.jnlua-lua51/src/com/naef/jnlua/eclipse/AbstractLuaModule.java
Previous Topic:Autocompletion for external API
Next Topic:Breakpoint not hit after attaching to Java application
Goto Forum:
  


Current Time: Sun Dec 21 18:57:46 GMT 2014

Powered by FUDForum. Page generated in 0.01557 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software