[metalua] Parsing and Grammar

26 views
Skip to first unread message

Jon Akhtar

unread,
Mar 3, 2012, 11:31:31 AM3/3/12
to metalua
I am considering supporting metalua syntax in the next version of my
IDE. I have another Lua variant I am in the process of supporting, so
I makes sense to ask about this.

Can you give me a primer of just what challenges I may face? Parsing/
Lexing? Semantics?

Fabien Fleutot

unread,
Mar 7, 2012, 4:18:02 AM3/7/12
to met...@googlegroups.com
Hi,

metalua grammars are easy to extend as long as your extensions respect Lua's spirit. That's a feature not a bug: if your grammar extension is hard to express, it probably doesn't respect Lua's implicit rule that a single token lookahead is enough to parse it. It's also very likely that it introduces unforeseen ambiguities. 

Semantics is easy as long as you can express your extensions as a function modifying ASTs.

Anyway, adding rules to statement and/or expression parsers is easy, especially if they are introduced by dedicated keywords, as is the case in most of Lua. Can you share an example of the extensions you're considering?
--
Fabien Fleutot
+---
| 33 chemin de Mange-Pommes
| 31520 Ramonville Saint-Agne -- France
| mobile: +33 6 28 06 09 97
| office: +33 5 61 00 06 49
| home: +33 5 61 75 05 67
Reply all
Reply to author
Forward
0 new messages