lua-users home
lua-l archive

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


Thanks for the suggestions. Metalua was actually one of the ideas I
had. I think my solution is simpler anyway, and has no big downside.

The changes I've done have basically the purpose of distinguishing
between Lua statements and shell-like commands.
For example I want the parser to tell the difference from
vim .lshrc
and
vim.lshrc

In the AST representation of Metalua I cannot do this as the
difference has been discarded by the time it is produced. I should
have rewritten the grammar distinguishing the two by scratch. This is
just one of many problems I had, so it was simpler to modify Lua a
little bit.

There is no way I can see to mix shell commands and complete Lua
syntax. So whether It is done in C or in Metalua, the interpreter will
look the same to the user, because it will forbid some (not so common
I hope) Lua syntax to better distinguish the two.

On 22/05/07, Ketmar Dark <ketmar@online.ua> wrote:
On Tue, 22 May 2007 10:05:41 +0200
"Mauro Iazzi" <mauro.iazzi@gmail.com> wrote:

> To the point: I have modified Lua code to change the parser. The
> result is that it that parses differently from Lua (but generates the
> same bytecode and has the same API). The main changes are quite small
> (with one exception) so that most Lua code will compile anyway.
I think that such a parser can be written in Lua itself. it won't be
fast, but I think the speed will be acceptable for a shell.

some time ago I wrote a parser for Object Pascal language and it was
reasonably fast on my pIII/600 (and the parser code was too complicated
and unoptimal). if such a thing will be done in pure Lua, anyone can to
use it with vanilla Lua binaries.

take a look at Yelliang or Metalua as a good tool/starting point for
this task.