[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simple Parsing: Tuning Spoken Lua Readouts in a Screen Reader
- From: KHMan <keinhong@...>
- Date: Sat, 17 May 2008 17:37:35 +0800
Veli-Pekka Tätilä wrote:
> Question: [snip]
> 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. My own feeble attempt at a very
> simple hand-coded recursive descent parser failed miserably due to the
> grammar being left-recursive and for operator precedence issues. Is
> there a reworked grammar somewhere that doesn't include the
> left-recursion in the definition of expression? Even so I doubt I'll
> ever get my own parser hack working properly, <embarassed smile>.
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. So, plus
the lexer, a callback parser for Lua should be feasible at about
1000 lines sans comments. (I plan to get a native 5.1.3 parser
skeleton done in the near term.) Yueliang deliberately keep to its
C roots, which may or may not be easier to develop or maintain.
> [snip]
> There might be yet another way to go about this, too. If there's a Lua
> disassembler, one could actually have a read out of what Lua sees during
> it parsing the code on the fly. rather than reading the actual code.
> However, this would get rid of all comments and I'm not sure, since I am
> not familiar with any internals, how CLEARLY the byte code corresponds
> to the statements in the source file i.e. is it easy to understand and
> how much things get optimized. THat is sometimes a problem in Perl's
> error messages and the deparse module.
luac already provides a basic disassembly listing. ChunkSpy on
LuaForge provides disassembly in a little bit more detail. In
conjuction with ChunkSpy, I have written a document discussing Lua
bytecodes at:
http://luaforge.net/docman/view.php/83/98/ANoFrillsIntroToLua51VMInstructions.pdf
http://luaforge.net/docman/view.php/83/99/ANoFrillsIntroToLua51VMInstructions.odt
Please let me know if you require the above in other formats.
> [snip]
HTH,
--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia