parsing - Where does context sensitivity get resolved in the C++ compilation process? -
Yesterday I asked about the C ++ reference sensitivity, see. Among the many excellent answers are acceptable, by
However, I still feel that something about it (perhaps some glossary confusion?). According to the question: What part of the compilation is related to ambiguity?
To clarify your vocabulary: A Cfg is a grammar in which there is only one non-terminal symbol in the left hand side of the rule (e.g., A-> zC
), A CSG is one in which there is a terminal (plus non-terminal) on the left ( aav-> qt
), where the uppercase letters are non-terminal and lowercase terminals.
Does grammar have any representation in the parsing C ++ source code as the latter one?
Thank you, and sorry to take the issue forward.
Any C + + front end (parser, name / type resolver) that I know () The context implements the sensitive parser using the CSG grammar rules, as you defined it. Very much they operate in a clear or implicit manner with a reference free grammar that still remains ambiguous.
Many of them do not have top-down parsing and type keys to differentiate between unclear cases. Use a collection of information collections.
Weaving together the parsing and typing collection works to create a parse that is really messy and difficult, the folk theorem is "difficult to parse" C ++.
Many types of "theorems", this is not true unless you have a hand tied behind your back (for example, recurring descent, LL.K), LALR [i.e., Y.C.C.]) Let's emphasize the parsing of. If you can use an ambiguity that can handle the ambiguity, then C ++ grammar is not really so hard we use GLR parsing technology due to this (and others, such as C + + parser). (We move a bit further and capture macro definitions, usage and preprocessor conditions in C ++ grammar because the processor is interested in changing the code before it is wasted; usually the preprocessor instructions are completely free Behave differently in the preprocessor.)
Elsa I think that still in the parsing process to hide the solution of ambiguity, Lake Because parsing is so clear that it is easy to do. Our front end creates an AST with ambiguity nodes, and after the formation of the tree, we walk on the tree using a specialty grammar evaluator to collect names, and types, and eliminate those branches of ambiguity The ones who are inconsistent are the latter really a beautiful plan, and completely parsing decouples and name resolutions.
What is is is actually a pretty mysterious plan to see things near C ++, and is extending into 600 pages of standard, As well as there are various dialects inclined by different dialects. Keeping the name resolution different from parsing makes this ugliness more manageable, but the folk theorem should be "C ++ is hard to solve".
Comments
Post a Comment