Nmap Development mailing list archives
Re: Lua and LPeg
From: Patrick Donnelly <batrick () batbytes com>
Date: Fri, 5 Mar 2010 16:51:47 -0500
On Fri, Mar 5, 2010 at 2:23 PM, David Fifield <david () bamsoftware com> wrote:
On Mon, Mar 01, 2010 at 01:53:14PM -0500, Patrick Donnelly wrote:On Mon, Mar 1, 2010 at 3:35 AM, Martin Holst Swende <martin () swende se> wrote:Yes and no. I took a quick look at what libraries existed, but license issues (of which I am no expert) and/or overly complicated behaviour put me off. For example, the luaforge-library is 10+files (not counting testcases) and, in addition, requires Lpeg, a complete library for parsing grammar. Had Json been a lot more complex than it actually is, that perhaps had seemed the best solution. That being said, other implementations may be better than mine, and if you have any suggestions once you have looked at the code they are most welcome.Well, the luaforge library is MIT licensed (same as Lua) so no problem there. The library itself is modularized into files which is good and bad, mostly good when it comes to LPeg. My feeling on LPeg is that Nmap will eventually have it because Lua will eventually have it. Plus, LPeg is appropriate for most parsing problems (JSON fits nicely) that are network related. What we are waiting for is a library/script that heavily relies on it that justifies the addition of LPeg. The JSON library may have been that library :)LPeg is planned to be in a future release of Lua, right? Then I think we should wait for that so that someone else is maintaining it. I admit that it is cool technically and I am interested in learning more about it.
Well, it is highly probable but it could be quite a while before that happens. Roberto gives us a maybe [1] but definitely not for Lua 5.2. I don't think it is prudent for us to wait for Lua to officially add it because that version will likely be many years away due to Lua's release cycle [2]. About maintaining it, Roberto (author of Lua) is developing LPeg so there should be no worries about that. I think if we wanted to add it now we could improve a lot of libraries as well as NSE. I believe I showed you the script args code implemeneted in LPeg and the improvement in readability and code size (58 -> 20 lines, not including extraneous newlines) was quite good (attached). I'm fairly certain libraries like the http or json library would benefit as well. [1] http://lua-users.org/lists/lua-l/2008-02/msg00724.html [2] http://www.lua.org/versions.html -- - Patrick Donnelly
Attachment:
sargs-lpeg.patch
Description:
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- CouchDB and MongoDB, (continued)
- CouchDB and MongoDB Martin Holst Swende (Feb 03)
- Re: CouchDB and MongoDB David Fifield (Feb 15)
- Re: CouchDB and MongoDB Martin Holst Swende (Feb 22)
- Re: CouchDB and MongoDB David Fifield (Feb 23)
- Re: CouchDB and MongoDB Martin Holst Swende (Feb 27)
- Re: CouchDB and MongoDB David Fifield (Feb 28)
- Re: CouchDB and MongoDB Patrick Donnelly (Feb 28)
- Re: CouchDB and MongoDB Martin Holst Swende (Mar 01)
- Re: CouchDB and MongoDB Patrick Donnelly (Mar 01)
- Lua and LPeg David Fifield (Mar 05)
- Re: Lua and LPeg Patrick Donnelly (Mar 05)
- Re: CouchDB scripts Martin Holst Swende (Feb 01)
- Re: MongoDB scripts David Fifield (Jan 29)