|
|
Line 1: |
Line 1: |
| {{expert|date=June 2012}}
| | Prostatic congestion and inflammation can stimulate the prostate urethra inducing frequent spermatorrhea. Very occasionally, two females will fight over a male. Chances are, you are probably reading this because either you or a loved one suffers from male impotence. In many cases, erectile dysfunction is curable and indeed in recent years the markets have been flooded with pills that can help men achieve and maintain erections strong. Ovulation means your ovaries are releasing an egg down your fallopian tubes and into your uterus, where the baby will stay for 9 months once it is conceived. <br><br>Not only that, the process of cell repair can also be done well ( the regenerate ) , that old cells replaced with better ones. If you care to join our Freethinkers group we meet the third Saturday of every month in Syracuse. And for them, the clear choice is to use herbal remedies. Cigarettes affect the amount of oxygen your body can absorb. Alcohol or drug abuse: Drugs such as antidepressants, sedatives, and antihypertensives have been known to contribute to impotence. <br><br>Men who are impotent from diabetes must seek treatment every month and each month, the attending doctor must draw a blood test called HBA1C, or another blood test called fructosamine. Therefore, if you are considering boosting your testosterone either by using a natural testosterone supplement or by visiting your doctor for testosterone injections or creams, you should look online to get a feel for what products are working for other men. For many leaders this can be a bewildering, confidence-sapping time - for them, this doesn't feel like a transition from adolescence to maturity. They might also incorporate a shallower central dip that is more suited to the female pelvic structure. The advantage that herbal impotence cures have over different cures is that they are much cheaper and are out there everywhere. <br><br>This process involves an intraocular implant which is even popularly known as the iris implants and with the help of this you can easily change one's eye colour instead of using the color contacts or the lenses. Another popular herb is the Panax Ginseng, which is generally used for improving mental and physical prowess. In fact, hops may be part of the reason why heavy beer drinkers often experience hormonal shifts and develop enlarged bellies and breasts. Other diseases that can affect the nervous system, such as Alzheimer's disease, multiple sclerosis, and stroke. Also, if you keep sitting in one position throughout the day, the chances are rife that you could suffer from impotency too. <br><br>This included eating healthy diet, daily exercise, and adequate sleep. Aniseed has estrogen and it affects the male sex hormones. Not all studies point to such benefits, however, and many conventional doctors remain skeptical. This is why Erectile Dysfunction Drugs were created. Follow the instructions on container for the required dosage.<br><br>If you beloved this posting and you would like to receive much more information relating to best over the counter ed pills ([http://www.eiaculazione-precoce.info/sitemap/ what is it worth]) kindly visit our own web site. |
| {{confusing|date=June 2012}}
| |
| | |
| In the [[formal language theory]] of [[computer science]], '''left recursion''' is a special case of [[recursion]].
| |
| | |
| In terms of [[context-free grammar]], a non-terminal <code>r</code> is left-recursive if the left-most symbol in any of <code>r</code>’s productions (‘alternatives’) either immediately (direct/immediate left-recursive) or through some other non-terminal definitions (indirect/hidden left-recursive) rewrites to <code>r</code> again.
| |
| | |
| == Definition ==
| |
| "A grammar is left-recursive if we can find some non-terminal A which will eventually derive a [[sentential form]] with itself as the left-symbol."<ref>[http://www.cs.may.ie/~jpower/Courses/parsing/parsing.pdf#search='indirect%20left%20recursion' Notes on Formal Language Theory and Parsing], James Power, Department of Computer Science National University of Ireland, Maynooth Maynooth, Co. Kildare, Ireland.[[JPR02]]</ref>
| |
| | |
| === Immediate left recursion ===
| |
| Immediate left recursion occurs in rules of the form
| |
| :<math>A \to A\alpha \mid \beta</math>
| |
| where <math>\alpha</math> and <math>\beta</math> are sequences of nonterminals and terminals, and <math>\beta</math> doesn't start with <math>A</math>. For example, the rule
| |
| :<math>\mathit{Expr} \to \mathit{Expr} + \mathit{Term}</math>
| |
| is immediately left-recursive. The ''[[recursive descent parser]]'' for this rule might look like:
| |
| <source lang="text">
| |
| function Expr()
| |
| {
| |
| Expr(); match('+'); Term();
| |
| }
| |
| </source>
| |
| and a recursive descent parser would fall into infinite recursion when trying to parse a grammar which contains this rule.
| |
| | |
| === Indirect left recursion ===
| |
| Indirect left recursion in its simplest form could be defined as:
| |
| :<math>A \to B\alpha \mid C</math>
| |
| :<math>B \to A\beta \mid D,</math>
| |
| possibly giving the derivation <math>A \Rightarrow B\alpha \Rightarrow A\beta\alpha \Rightarrow \ldots </math>
| |
| | |
| More generally, for the nonterminals <math>A_0, A_1, \ldots, A_n</math>, indirect left recursion can be defined as being of the form:
| |
| :<math>A_0 \to A_1\alpha_1 \mid \ldots</math>
| |
| :<math>A_1 \to A_2\alpha_2 \mid \ldots</math> | |
| :<math>\cdots</math>
| |
| :<math>A_n \to A_0\alpha_{n+1} \mid \ldots</math>
| |
| where <math>\alpha_1, \alpha_2, \ldots, \alpha_n</math> are sequences of nonterminals and terminals.
| |
| | |
| == Accommodating left recursion in top-down parsing ==
| |
| A [[formal grammar]] that contains left recursion cannot be [[parse]]d by a [[LL parser|LL(k)-parser]] or other naive [[recursive descent parser]] unless it is converted to a [[Weak equivalence (formal languages)|weakly equivalent]] right-recursive form. In contrast, left recursion is preferred for [[LALR]] parsers because it results in lower stack usage than [[right recursion]]. However, more sophisticated top-down parsers can implement general [[context-free grammar]]s by use of [[curtailment]]. In 2006, Frost and Hafiz described an algorithm which accommodates [[ambiguous grammar]]s with direct left-recursive [[Formal grammar#The syntax of grammars|production rules]].<ref name="FrostHafiz2006">{{cite journal|last=Frost|first=R.|coauthors=R. Hafiz|date=2006|title=A New Top-Down Parsing Algorithm to Accommodate Ambiguity and Left Recursion in Polynomial Time.|journal=ACM SIGPLAN Notices|volume=41|issue=5|pages=46–54|url=http://portal.acm.org/citation.cfm?id=1149988|doi=10.1145/1149982.1149988}}</ref> That algorithm was extended to a complete [[parsing]] algorithm to accommodate indirect as well as direct left-recursion in [[polynomial]] time, and to generate compact polynomial-size representations of the potentially exponential number of parse trees for highly ambiguous grammars by Frost, Hafiz and Callaghan in 2007.<ref name="FrostHafizCallaghan2007">{{cite journal|last=Frost|first=R.|coauthors=R. Hafiz and P. Callaghan|date=June 2007|title=Modular and Efficient Top-Down Parsing for Ambiguous Left-Recursive Grammars.|journal=10th International Workshop on Parsing Technologies (IWPT), ACL-SIGPARSE|location=Prague|pages=109–120|url=http://acl.ldc.upenn.edu/W/W07/W07-2215.pdf}}</ref> The authors then implemented the algorithm as a set of [[parser combinator]]s written in the [[Haskell (programming language)|Haskell]] programming language.<ref name="FrostHafizCallaghan2008">{{cite journal|last=Frost|first=R.|coauthors=R. Hafiz and P. Callaghan|date=January 2008|title=Parser Combinators for Ambiguous Left-Recursive Grammars|journal=10th International Symposium on Practical Aspects of Declarative Languages (PADL), ACM-SIGPLAN|volume=4902|issue=2008|pages=167–181|url=http://cs.uwindsor.ca/~richard/PUBLICATIONS/PADL_08.pdf|doi=10.1007/978-3-540-77442-6_12|series=Lecture Notes in Computer Science|isbn=978-3-540-77441-9}}</ref>
| |
| | |
| == Removing left recursion ==
| |
| === Removing immediate left recursion ===
| |
| The general algorithm to remove immediate left recursion follows. Several improvements to this method have been made, including the ones described in "Removing Left Recursion from Context-Free Grammars", written by Robert C. Moore.<ref name="Moore2000">{{cite journal|last=Moore|first=Robert C.|title=Removing Left Recursion from Context-Free Grammars|journal=6th Applied Natural Language Processing Conference|date=May 2000|pages=249–255|url=http://research.microsoft.com/pubs/68869/naacl2k-proc-rev.pdf}}</ref>
| |
| For each rule of the form
| |
| | |
| <math>A \rightarrow A\alpha_1\,|\,\ldots\,|\,A\alpha_n\,|\,\beta_1\,|\,\ldots\,|\,\beta_m </math>
| |
| | |
| where:
| |
| | |
| * A is a left-recursive nonterminal
| |
| * <math>\alpha</math> is a sequence of nonterminals and terminals that is not null (<math>\alpha \ne \epsilon </math>)
| |
| * <math>\beta</math> is a sequence of nonterminals and terminals that does not start with A.
| |
| | |
| replace the A-production by the production:
| |
| | |
| <math>A \rightarrow \beta_1A^\prime\, |\, \ldots\, |\, \beta_mA^\prime</math>
| |
| | |
| And create a new nonterminal
| |
| | |
| <math>A^\prime \rightarrow \epsilon\, |\, \alpha_1A^\prime\, |\, \ldots\, |\, \alpha_nA^\prime</math>
| |
| | |
| This newly created symbol is often called the "tail", or the "rest".
| |
| | |
| As an example, consider the rule
| |
| | |
| <math>Expr \rightarrow Expr\,+\,Expr\,|\,Int\,|\,String</math> | |
| | |
| This could be rewritten to avoid left recursion as | |
| | |
| <math>Expr \rightarrow Int\,ExprRest\,|\,String\,ExprRest</math>
| |
| | |
| <math>ExprRest \rightarrow \epsilon\,|\,+\,Expr\,ExprRest</math>
| |
| | |
| The last rule happens to be equivalent to the slightly shorter form
| |
| | |
| <math>ExprRest \rightarrow \epsilon\,|\,+\,Expr</math>
| |
| | |
| === Removing indirect left recursion ===
| |
| If the grammar has no <math>\epsilon</math>-productions (no productions of the form <math>A \rightarrow \ldots | \epsilon | \ldots </math>) and is not cyclic (no derivations of the form <math>A \Rightarrow \ldots \Rightarrow A </math> for any nonterminal A), this general algorithm may be applied to remove indirect left recursion :
| |
| | |
| Arrange the nonterminals in some (any) fixed order <math>A_1, \ldots A_n</math>.
| |
| | |
| : for i = 1 to n {
| |
| ::for j = 1 to i – 1 {
| |
| :::* let the current <math>A_j</math> productions be
| |
| :::<math>A_j \rightarrow \delta_1 | \ldots | \delta_k</math>
| |
| :::* replace each production <math>A_i \rightarrow A_j \gamma</math> by
| |
| :::<math>A_i \rightarrow \delta_1\gamma | \ldots | \delta_k\gamma</math>
| |
| ::}
| |
| ::* remove direct left recursion for <math>A_i</math>
| |
| :}
| |
| | |
| == Pitfalls ==
| |
| The above transformations remove left-recursion by creating a right-recursive grammar; but this changes the associativity of our rules. Left recursion makes left associativity; right recursion makes right associativity.
| |
| Example:
| |
| We start with a grammar:
| |
| | |
| <math>Expr \rightarrow Expr\,+\,Term\,|\,Term</math>
| |
| | |
| <math>Term \rightarrow Term\,*\,Factor\,|\,Factor</math>
| |
| | |
| <math>Factor \rightarrow (Expr)\,|\,Int</math>
| |
| | |
| After having applied standard transformations to remove left-recursion, we have the following grammar:
| |
| | |
| <math>Expr \rightarrow Term\ Expr'</math>
| |
| | |
| <math>Expr' \rightarrow {} + Term\ Expr'\,|\,\epsilon</math>
| |
| | |
| <math>Term \rightarrow Factor\ Term'</math>
| |
| | |
| <math>Term' \rightarrow {} * Factor\ Term'\,|\,\epsilon</math>
| |
| | |
| <math>Factor \rightarrow (Expr)\,|\,Int</math>
| |
| | |
| Parsing the string 'a + a + a' with the first grammar in an LALR parser (which can recognize left-recursive grammars) would have resulted in the parse tree:
| |
| Expr
| |
| / | \
| |
| Expr + Term
| |
| / | \ \
| |
| Expr + Term Factor
| |
| | | |
| |
| Term Factor Int
| |
| | |
| |
| Factor Int
| |
| |
| |
| Int
| |
| This parse tree grows to the left, indicating that the '+' operator is left associative, representing ''(a + a) + a''. | |
| | |
| But now that we've changed the grammar, our parse tree looks like this:
| |
| Expr ---
| |
| / \
| |
| Term Expr' --
| |
| | / | \
| |
| Factor + Term Expr' ------
| |
| | | | \ \
| |
| Int Factor + Term Expr'
| |
| | | |
| |
| Int Factor <math>\epsilon</math>
| |
| |
| |
| Int
| |
| | |
| We can see that the tree grows to the right, representing ''a + (a + a)''. We have changed the associativity of our operator '+', it is now right-associative. While this isn't a problem for the associativity of integer addition, it would have a significantly different value if this were subtraction.
| |
| | |
| The problem is that normal arithmetic requires left associativity. Several solutions are: (a) rewrite the grammar to be left recursive, or (b) rewrite the grammar with more nonterminals to force the correct precedence/associativity, or (c) if using [[YACC]] or [[GNU bison|Bison]], there are ''operator declarations,'' %left, %right and %nonassoc, which tell the [[parser generator]] which associativity to force.
| |
| | |
| == See also ==
| |
| * [[Tail recursion]]
| |
| | |
| == References ==
| |
| <references />
| |
| | |
| == External links ==
| |
| * [http://www.cs.umd.edu/class/fall2002/cmsc430/lec4.pdf CMU lecture on left-recursion]
| |
| * [http://lambda.uta.edu/cse5317/notes/node21.html Practical Considerations for LALR(1) Grammars]
| |
| * [http://www.cs.uwindsor.ca/~hafiz/proHome.html X-SAIGA] - eXecutable SpecificAtIons of GrAmmars
| |
| | |
| [[Category:Control flow]]
| |
| [[Category:Formal languages]]
| |
| [[Category:Parsing]]
| |
| [[Category:Recursion]]
| |
Prostatic congestion and inflammation can stimulate the prostate urethra inducing frequent spermatorrhea. Very occasionally, two females will fight over a male. Chances are, you are probably reading this because either you or a loved one suffers from male impotence. In many cases, erectile dysfunction is curable and indeed in recent years the markets have been flooded with pills that can help men achieve and maintain erections strong. Ovulation means your ovaries are releasing an egg down your fallopian tubes and into your uterus, where the baby will stay for 9 months once it is conceived.
Not only that, the process of cell repair can also be done well ( the regenerate ) , that old cells replaced with better ones. If you care to join our Freethinkers group we meet the third Saturday of every month in Syracuse. And for them, the clear choice is to use herbal remedies. Cigarettes affect the amount of oxygen your body can absorb. Alcohol or drug abuse: Drugs such as antidepressants, sedatives, and antihypertensives have been known to contribute to impotence.
Men who are impotent from diabetes must seek treatment every month and each month, the attending doctor must draw a blood test called HBA1C, or another blood test called fructosamine. Therefore, if you are considering boosting your testosterone either by using a natural testosterone supplement or by visiting your doctor for testosterone injections or creams, you should look online to get a feel for what products are working for other men. For many leaders this can be a bewildering, confidence-sapping time - for them, this doesn't feel like a transition from adolescence to maturity. They might also incorporate a shallower central dip that is more suited to the female pelvic structure. The advantage that herbal impotence cures have over different cures is that they are much cheaper and are out there everywhere.
This process involves an intraocular implant which is even popularly known as the iris implants and with the help of this you can easily change one's eye colour instead of using the color contacts or the lenses. Another popular herb is the Panax Ginseng, which is generally used for improving mental and physical prowess. In fact, hops may be part of the reason why heavy beer drinkers often experience hormonal shifts and develop enlarged bellies and breasts. Other diseases that can affect the nervous system, such as Alzheimer's disease, multiple sclerosis, and stroke. Also, if you keep sitting in one position throughout the day, the chances are rife that you could suffer from impotency too.
This included eating healthy diet, daily exercise, and adequate sleep. Aniseed has estrogen and it affects the male sex hormones. Not all studies point to such benefits, however, and many conventional doctors remain skeptical. This is why Erectile Dysfunction Drugs were created. Follow the instructions on container for the required dosage.
If you beloved this posting and you would like to receive much more information relating to best over the counter ed pills (what is it worth) kindly visit our own web site.