The building blocks of Logikus programs are structures and variables. A typical structure has a string as its functor and has terms enclosed in parentheses. For now, let's sketch a grammar that will recognize a structure such as
starred(jamesCagney, "Mister Roberts", Year)
The following grammar gives a first draft for recognizing Logikus structures and variables:
structure = functor ('(' commaList(term) ')' | Empty); functor = LowercaseWord | QuotedString; term = structure | variable; variable = UppercaseWord; commaList(p) = p (',' p)*;
Note that the functor of a structure cannot be an uppercase word. Logikus shares this feature with Prolog; users need not and cannot declare variables. A string that begins with an ...