Sunday, March 21, 2010

The Conditional Production

The primary notion in Grogix is the "extraction" of structure, or essence, or form, "from" the system being designed, and the "concentration" of that structure "into" the operational grammar, which executes the system.

The basic construct that makes this possible is The Conditional Production. The typical grammar used for parsing will pair patterns with actions, which can be transformations. In contrast, the Conditional Production in the grammar only defines the non-terminal if the condition is met at run-time. This, along with the recursion found in any grammar, allows the definition of a single, finite grammar with infinite numbers of state combinations. Any programming language with iteration or recursion can do this, but only Grogix puts it into a single grammatical structure.

Grogix's "hello world" example:

. start ... default ... hello world

And a more complex version, making use of Conditional Productions:

. start ... default ... hello {{name}}
. name ... *user=="greg" ... mister G
. name ... default ... {{*user}}

"default" is the default or base condition. When a conditional expression that evaluates true is reached, moving from the top to the bottom of the list of productions, that production becomes active.

In these examples, the far right, past the second ellipsis, is a text template, marked or escaped by these {{ call outs }} to further non-terminals or variable values.

The * construction represents an interface variable.

The grammar runs within an interface, and the grammar has various ways of receiving values from the interface. The interface here is not defined, making the grammar a kind of operational idealization, which can be used with multiple interfaces. One interface that we can imagine for these examples is a terminal program which has the user's login name available to it, which it then provides to the grammar. The grammar exits when the tree is fully traversed. We could imagine the interface then provides this result to the user, and quits. We could also imagine the exact same grammar for a web-based terminal service. A grammar can be written to remain abstract from such considerations, making it ideal for portability, or insertion into legacy situations. It could be also contain layers of sets of productions specifically written to deal with the outside world beyond more transparent interfaces, and these layers might be swapped out for different outside contexts.

None of this would make much sense without the key idea of a central grammar executing the system. With Grogix, and Blooming Logic, one has to think of grammars differently, as the central organizing notation for computation, rather than as a tool for defining language syntax.

1 comment:

  1. What the ellipses remind me of, more than anything, is the Underpants Gnomes:

    1. Collect underpants
    2. ...
    3. Profit!

    ReplyDelete