lua-users home
lua-l archive

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


Sorry for resurrecting a two month old thread. About a week or so ago I was
working on a project where I wanted something like JSON to represent my
data, but since I'm partial to Lua, I really preferred to have something
that was closer in syntax to Lua tables. I looked around and saw this
thread mention a hypothetical 'LON' format, but no c library ever
materialized. So I wrote it myself based on what some of the people were
saying they'd like to see in such a format.

The code is available here:

https://bitbucket.org/alexames/lon

I basically started out with a copy of Lua 5.1 and just started stripping
things down. I got rid of the VM and garbage collection and any and all
support for threads and functions and userdata until all I was left with
was the Lua lexer, parser, and table and string implementations (more or
less). And since there's no VM you can be sure the string being parsed will
terminate and won't run any undesired functions or anything like that.

The strings it accepts should be a strict subset of Lua (the parser is the
same one Lua uses after, just stripped down). Lon only supports 5 data
types: nil, boolean, number, string, and tables. It also supports comments.

Just thought I'd put this out there in case anyone is interested or has any
feedback. There's a simple test project as lua bindings included as well.
The Makefile could probably be improved, but it's been a while since I've
done much work in Linux, but it should work for now.

Alex