Skip to main content



      Home
Home » Archived » 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] Fri, 29 November 2013 22:14 Go to next message
Eclipse UserFriend
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 12:06 Go to previous message
Eclipse UserFriend
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: Fri Mar 21 01:04:33 EDT 2025

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

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

Back to the top