Exemplos de uso de Parsing expression em Inglês e suas traduções para o Português
{-}
-
Colloquial
-
Official
-
Medicine
-
Financial
-
Ecclesiastic
-
Ecclesiastic
-
Computer
-
Official/political
The parsing expression('a'/'b')* matches and consumes an arbitrary-length sequence of a's and b's.
Each parsing rule in P has the form A← e,where A is a nonterminal symbol and e is a parsing expression.
Formally, a parsing expression grammar consists of: A finite set N of nonterminal symbols.
Therefore, not all languages that can be expressed using parsing expression grammars can be parsed by LL or LR parsers.
An atomic parsing expression consisting of the empty string always trivially succeeds without consuming any input.
E"=== Semantics===The fundamental difference between context-free grammars and parsing expression grammars is that the PEG's choice operator is"ordered.
Parsing expression grammars(PEGs): a more recent generalization of TDPL designed around the practical expressiveness needs of programming language and compiler writers.
And-predicate:&e Not-predicate:! e The fundamental difference between context-free grammars and parsing expression grammars is that the PEG's choice operator is ordered.
Given any existing parsing expressions e, e1, and e2,a new parsing expression can be constructed using the following operators: Sequence: e1 e2 Ordered choice: e1/ e2 Zero-or-more: e* One-or-more: e+ Optional: e?
Part of the effort in the design of Perl 6 is to improve Perl's regex integration, and to increase their scope andcapabilities to allow the definition of parsing expression grammars.
In computer science, a parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language.
Part of the effort in the design of Perl 6 is to improve Perl's regular expression integration, and to increase their scope andcapabilities to allow the definition of parsing expression grammars.
Each nonterminal in a parsing expression grammar essentially represents a parsing function ina recursive descent parser, and the corresponding parsing expression represents the"code" comprising the function.
Because of this memoization, a packrat parser has the ability to parse many context-free grammars and any parsing expression grammar(including some that do not represent context-free languages) in linear time.
An atomic parsing expression consisting of a nonterminal A represents a recursive call to the nonterminal-function A. A nonterminal may succeed without actually consuming any input, and this is considered an outcome distinct from failure.
It is also possible to build LL parsers andLR parsers from parsing expression grammars, with better worst-case performance than a recursive descent parser, but the unlimited lookahead capability of the grammar formalism is then lost.
A parsing expression is a hierarchical expression similar to a regular expression, which is constructed in the following fashion: An atomic parsing expression consists of: any terminal symbol, any nonterminal symbol, or the empty string ε.
It is possible to obtain better performance for any parsing expression grammar by converting its recursive descent parser into a"packrat parser", which always runs in linear time, at the cost of substantially greater storage space requirements.
An atomic parsing expression consisting of a single terminal(i.e. literal) succeeds if the first character of the input string matches that terminal, and in that case consumes the input character; otherwise the expression yields a failure result.
See also==* Formal grammar* Regular expressions* Top-down parsing language* Comparison of parser generators* Parser combinators== References==== External links==* Parsing Expression Grammars: A Recognition-Based Syntactic Foundation( PDF slides)* Converting a string expression into a lambda expression using an expression parser* The Packrat Parsing and Parsing Expression Grammars Page* Packrat Parsing: a Practical Linear-Time Algorithm with Backtracking* The constructed language Lojban has a fairly large PEG grammar allowing unambiguous parsing of Lojban text.
The following parsing expression grammar describes the classic non-context-free language formula_2:The following recursive rule matches standard C-style if/then/else statements in such a way that the optional"else" clause always binds to the innermost"if", because of the implicit prioritization of the'/' operator.
Operational interpretation of parsing expressions===Each nonterminal in a parsing expression grammar essentially represents aparsing function in a recursive descent parser, and the corresponding parsing expression represents the"code" comprising the function.
Parses an expression and returns computed value.
Results from regular expression parsing and grouping(now based on Perl's regular expression syntax) can be retrieved using mod_include's variables $0… $9.
If set to true any LaTeX expression is parsed this can be a potential security risk.