Scala: Operator and parser, scala operator Parsing
The names of variables, functions, and classes are collectively referred to as identifiers. The backquotes can contain almost any character sequence.
In scala,
-Operator ending with Colon
-Value assignment operator
All operators are left-bound.
The unapply method accepts an object and then takes the value from it, usually the value originally used to construct the object. The sequence of values of any length. Generally, the unapplySeq naming method is used.
The Scala parser library is an advanced example of the scala language's overall built-in domain-specific language (DSL. To use the Scala parser library, you need to provide a class that extends the features of Parsers and define resolution operations that combine basic operations, including:
1) match a lexical Unit
2) select between two operations (|)
3) perform two operations in sequence (~)
4) repeat an operation (rep)
5) Select an operation (opt)
~ The returned result is ~ The instance of the sample class is not dual, which makes pattern matching easier. To generate a resolution tree, you must use the ^ operator to provide functions for generating Tree nodes, avoiding left recursion and backtracking.
The StandardTokenParsers class provides a parser that generates these lexical units.