Scala: Operator and parser, scala operator Parsing

Source: Internet
Author: User
Tags in domain

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.