Top  Previous  Next

Scripts > Productions > Elements


Similar to tokens, which are connecting characters, productions connect tokens. Regular sequences or alternatives of token sequences can be formulated as a rule, that means as a production.


Definitions of productions are based on three kinds of elements:


1a)        Literal tokens directly defined inside of a production

1b)        Named tokens, defined on the token page

2.        Other productions


Remark: The text, which a token matched, is accessible by xState.str()



About 1a)  Literal tokens directly defined inside of a production


Simple words of the natural language or key words of a formalized language, punctuation marks, operators etc. can, but must not be defined on the token page. These literal token can be defined directly inside of a production by including them into quotes.




"TETRA"        matches: TETRA

";"                matches: ;


If the quotation mark shall be used as a component of a literal token, then a backslash '\' must be put in front of character to distinguish it of the enclosing quotation marks. The backslash must as well be put in front a backslash.


"\""                matches: "

"\\"        matches: \



About 1b) Named tokens, defined on the token page


The definition of complex token was described above. Inside of a production the names of already defined tokens can be used.


About 2. Other productions


The definition of a production can be based on the definitions of other productions by using the names of them.




Production1 ::= "hello" | "good bye"

Production2 ::= "world"

Production3 ::= Production1 Production2



This page belongs to the TextTransformer Documentation

Home  Content  German