[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: parser
- From: "Luiz Carlos Silveira" <luiz@...>
- Date: Thu, 1 Jun 2000 17:08:46 -0300
There is a way to use the Lua parser. I don't know what you are trying to do, what information you want, but if you are talking
about a tree of functions and variables definitions and usage, you can let the Lua parser compile the Lua code and then undump the
compiled code using "luac -u". You will need to parse the luac output (which is much more easier to do) and, as far as I've seen,
this solves the tree problem.
You may want to give a look at the undump to see how it can make your life easier. But you will need to simulate a Lua virtual
machine to find out who is who (for example, when you reach a CALL instruction, who is the called value - the function -, who are
the parameters and who receives the returned values).
We are doing exactly that around here (Fabrica Digital)
From: firstname.lastname@example.org [mailto:email@example.com]On
Behalf Of Martin Dvorak
Sent: Thursday, June 01, 2000 3:47 PM
To: Multiple recipients of list
I am thinking about developing some kind of development environment for Lua.
The main component of it should be source code editor with syntax
automatic statement completion, some kind of realtime error checking etc.
To implement all of these I need to be able to parse the source code into
kind of data structure (parse tree?). There are two ways to do it: create
parser (probably using some kind of attribute grammar) or find some way
to use Lua's parser. The second way would be definitely better solution,
but I am not sure if it is possible. From what I've seen in the source code,
it seem like the parser is very tightly interconnected with the bytecode
which makes it almost impossible to use it for other purposes.
Or am I wrong? Does anybody know about some way to reuse Lua's parser?
Or do you think it would be better to write new parser just for the editor?
Thanks very much for any opinion.