lua-users home
lua-l archive

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


Veli-Pekka Tätilä wrote:
> KHMan wrote:
>> Veli-Pekka Tätilä wrote:
>> > Most of the Lua parsers I've found Leg, luaparse and yueliang are
>> either
>> > not well documented, go way over my head or are overkill in features
>> for
>> > this purpose. The self-containedness requirement is mostly due to me
>> > simply wishing to put the parser and a screen reader script of mine in
>> > an app specific folder, and being able to use the code straight away in
>> > the screen reader for my text editor. <more snippage>
>> Being the guilty party for Yueliang, here is some info. Yueliang
>> 0.3.0 has a working native Lua 5.0.3 parser skeleton based on
>> Lua's C parser, and it's about 600 lines sans comments.
> Sounds good so far. In fact this is one of the modules I looked into and
> the one that seemed the most promissing. The trouble I had with it was,
> as far as I could tell, no clear documentation of how to get started,
> i.e. which file to import and what the public interface is, as well as
> what kind of structures it generates as output. There were plenty of
> files, maybe I didn't just look in the right one. Seems to me the
> individual files are well documented, however. With this in mind are
> there any other projects using your parser, so one could see how it is
> used in practice?

Yueliang is a casual project with no clear goals, so it's in bits
and pieces. You can follow what the bits and pieces are by looking
at what the test scripts use.

test_lparser_mk3.lua in the test directory exercises the
lparser_mk3.lua parser, and uses the llex_mk3.lua lexer as well.
The parser_log directory shows the result of the message logger
calls, basically showing which functions are called during
parsing, and it closely follows the original C equivalents.

It's missing some infrastructure to differentiate variables,
though, and it's Lua 5.0.x. But turning it into a callback-based
module certainly seems feasible.

> [snip]

-- 
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia