lua-users home
lua-l archive

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


Hi !

Lets say you have a language that looks as follows :

hello = 
  (a,b) ->
    print 'hello world'
    1 + 2
( It looks a lot like moonscript if that helps ) 

hello = \n  (a,b) ->\n    print 'hello world'\n    (1 + 2)\n

Would the token stream out of your LPEG grammer look ideally like this ?

[var hello]

[assign]

[indent 2]

[function start a b]

[indent 4]

[call print 'hello world']

[indent 4]

[call add 1 2]
 
[indent 2]

One final issue, when using -- lpeg.Ct -- How would I iterate over the table since I cannot call .length on it ?
Can I pass a metatable to lpeg.Ct that has a length operator ?

Hopefully I am in the right path, thanks for your help.
Cheers !