lua-users home
lua-l archive

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


 

----- Original Message -----

From: Francesco Abbate

Sent: 10/12/09 12:08 pm

To: lua@bazar2.conectiva.com.br

Subject: how to (slightly) modify the Lua parser

 

Hi all,


I know that in this list there are a lot of clever guys so I guess it is the good place to ask *very* difficult questions about Lua :-)

For my project, GSL shell, I would like to slightly modify the Lua parser to add some syntactic sugar. For example I would like to write:

|x| sin(x)/x

or

|x, y| sin(x) * cos(y)

as a function literal instead of

function(x) return sin(x)/x end
or
function(x,y) return sin(x) * cos(y) end


I've never actually used it myself, but isn't this the kind of problem token filters ( http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/ ) are supposed to solve?


Mike