-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
action parameter list #26
Comments
Bare functions only -- d7ee189. As for parameter list/RHS -- perhaps we can get away with the parlist altogether and just use Lua tables and context accessors, e.g. for -- all values
v = luif.context.values() -- { A = 'vA', B = 'vB', C = 'vC' }
vA = v.A, vB = v.B, vC = v.C
-- individual values
vA = luif.context.value('A')
vB = luif.context.value('B') for -- all values
v = luif.context.values() -- { A = { [1] = 'vA1', [2] = 'vA2' }, B = 'vB' }
vA1 = v.A[1]; vB = v.B; vA2 = v.A[2]
-- individual values
vA1 = luif.context.value('A', 1) -- <A:1>
vB = luif.context.value('B')
vA2 = luif.context.value('A', 2) -- <A:2> |
This continues the discussion of #11 |
Your prototyping may be revealing here. My guess is that you'll quickly But I might also be wrong. Perhaps syntax extension for the Lua code in One tactic is to delay the syntax extensions until after the first phase of On Mon, May 4, 2015 at 4:26 AM, rns notifications@github.com wrote:
|
Well, shortcuts like I'm thinking along the same lines -- try Building an ast and providing a sort of DOM akin to https://github.com/rns/MarpaX-Regex/blob/master/lib/MarpaX/Regex/AST/Base.pm remains an alternative. |
The LUIF's function should (at least for now) all reside in a namespace (Lua table) associated with the grammar set. If functions in other namespaces or methods are wanted, for now this can be done indirectly -- I'm not at all sure about the implications of the LUIF defining them.
Also, bare functions don't need a parameter list. The parameter list is the RHS of the rule, in effect.
Related to this, we need to define the syntax for referring to the RHS symbols. Starting with the simple case, an alternative like
X ::= A B C
, we have parametersA
,B
,C
. ForX ::= A B A
, they can beA:1
,B
,A:2
. When you get into grouped subrules, sequences, nestring, etc., stuff gets hard, which is why I dragged my feet on those extensions.Finally, I would also like to support the "angle-bracketed" form of the parameters in actions. This may create some parsing issues, since Lua also uses those for greater- and less-than, but we can hope those are not insuperable. By angle-bracketed, I mean for example, for the rule
X ::= A B A
,<A:1>
,<B>
,<A:2>
.The text was updated successfully, but these errors were encountered: