Lexically-scoped variables, shameless plug
Posted: Sun Jun 12, 2005 8:56 am
Apologies for suggesting something that may be a non-starter, and double apologies for a shameless plug:
Suggestion:
Adding lexically-scoped variables would not make the resulting grammars context-sensitive, since a variable set in a rule would only affect the expansion of that rule (and therefore all the ones it invokes, but not any of its siblings or ancestors in the result tree). The "current coordinate system" is already an implicit set of lexically-scoped variables that parameterize every rule; why not add user-specifiable variables of that sort? e.g.,
rule foo { bar { baz 2 } }
rule foo { bar { baz 0.5 } }
rule bar {
SQUARE { x baz s baz }
foo { }
}
rule bar {
SQUARE { x 1 s baz }
foo { }
}
This saves me from having to exhaustively enumerate every combination of parameters I want to compute for the square, given that sometimes I want s and x to be the same, and sometimes I don't.
Now, adding dynamically-scoped variables changes everything; I should know.
Shameless plug:
http://www.schneertz.com/rmutt
rmutt is a freeware random text-generation engine based on user-specifiable context-sensitive grammars.
Suggestion:
Adding lexically-scoped variables would not make the resulting grammars context-sensitive, since a variable set in a rule would only affect the expansion of that rule (and therefore all the ones it invokes, but not any of its siblings or ancestors in the result tree). The "current coordinate system" is already an implicit set of lexically-scoped variables that parameterize every rule; why not add user-specifiable variables of that sort? e.g.,
rule foo { bar { baz 2 } }
rule foo { bar { baz 0.5 } }
rule bar {
SQUARE { x baz s baz }
foo { }
}
rule bar {
SQUARE { x 1 s baz }
foo { }
}
This saves me from having to exhaustively enumerate every combination of parameters I want to compute for the square, given that sometimes I want s and x to be the same, and sometimes I don't.
Now, adding dynamically-scoped variables changes everything; I should know.
Shameless plug:
http://www.schneertz.com/rmutt
rmutt is a freeware random text-generation engine based on user-specifiable context-sensitive grammars.