lua-users home
lua-l archive

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

Trying to use the 'parser' module in Lua under Windows XP,
from the following program:

require 'parser'

function prod1_action (tree, token, pos)
	return {}

--prod1 = { "1", prod1_action }
prod1 = { "1" }  -- dummy, hardcoded, just for test
number = { prod1 }

grammar = { { "number", number} }
grammar.lexemes = {}

p = parser.Parser { grammar }

token1 = { ty = "NUMBER", tok = "1" }
dummy_program_tokens = { token1 }

function main ()
  result = p:parse ("NUMBER", dummy_program_tokens)



I'm not completely sure if the program is making a correct use of the
API, since the documentation does not provide an example and I was
unable to find one on Internet. However, I have found a bug in the
parser module itself:

1- Trying to run the above program, it gives an error in the 'parser'
module stating that there is no table.permute() function definition.
Googling a little, it seems that this function was available for
tables in a previous version of Lua
2- When I fix the parser module declaring the permute function
described above as a local function in 'parser', the module parsing is
ok but now my program gives another cryptical error. But may be this
is due to a bad understanding of the module API from my part .
However, I won't to go deeper with this since I'm not sure if this
module is currently maintained and if the permute() function I have
added is the originally expected by the module.

My main concern is
- Is this 'parser' module an unmaintained or deprecated module?
- If this is not the case, where can I find an example of code using
this module?

Duilio Protti.