![]() |
|
Navigation |
Synopsis Concrete patterns.
Syntax
` Token1 Token2 ... Tokenn ` (Symbol) ` Token1 Token2 ... Tokenn ` <Type Var> <Var>
Description Suppose we want to manipulate text written in some hypothetical language LANG.
Then first the concrete syntax of LANG has to be defined by importing a module that declares the non-terminals and syntax rules for LANG.
Next LANG programs have to be parsed. LANG programs made come from text files or they may be included in the Rascal program as literals.
In both cases the text is parsed according to the defined syntax and the result is a parse tree in the form of a value of type Tree.
Concrete patterns operate on these trees.
A concrete pattern is a quoted concrete syntax fragment that may contain variables. The syntax that is used to parse the concrete pattern may come from any module that has been imported in the module in which the concrete pattern occurs. A concrete pattern may have the following forms:
Examples Examples (in a context where an appropriate concrete syntax has been defined):
![]() |