In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "what are the knowledge points of the web interpreter mode", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what are the knowledge points of the web interpreter mode" can help you solve your doubts.
Grammatical modeling
As standard practice for interpreter patterns, the step after defining the syntax of a language is to prepare a class for each language element. For the examples of four operations, the class structure is as follows:
The class diagram is a little larger, so let's take a few rules as an example.
1. Generalization relation
Example: [5] PrimaryExpr::=NumericLiteral | ParenthesizedExpr | FunctionCall
The meaning of formula [5] is that the basic expression PrimaryExpr can be a numeric literal value NumerLiteral, a parenthesized expression ParemthesizedExpr, or a function call. Transforming into a class relationship is a generalization relationship. All places where PrimaryExpr applies can be replaced by one of NumericLiteral, ParenthesizedExpr, or FunctionCall.
two。 Combinatorial relationship
[2] AdditiveExpr::=MultiplicativeExpr ("+" >
When AdditiveExpr is composed of multiple MultiplicativeExpr, the relationship between them can be regarded as a combinatorial relationship.
When there is only one MultiplicativeExpr, the equation [2] can be reduced to:
AdditiveExpr::=MultiplicativeExpr
In this case, it can be regarded as a simple generalization relationship between the two.
3. Simple combinatorial relation
[7] ParenthesizedExpr::= "(" Expr ")"
Formula [7] can be regarded as a simple combinatorial relationship of 1 to 1.
Form a syntax tree
Look back at the expressions in the previous article:
100.0 * sin (29 + (23 * 6)) + sqrt (cos (34 * 5))
This expression is converted into a syntax tree as follows:
The analysis process is carried out from the top down along the class diagram until the appropriate type is found. For example, the initial analysis starts with AdditiveExpr, whose subordinate nodes should be multiple MultiplicativeExpr, but the right side does not meet the conditions of MultiplicativeExpr, so search down the class diagram until a qualified FuncitonCall is found. In this way, you can get the whole syntax tree over and over again.
After reading this, the article "what are the knowledge points of web interpreter mode" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.