|
Expression = Term . Expression = Term "+" Expression . Expression = Term "-" Expression . Term = Factor . Term = Factor "*" Term . Term = Factor "/" Term . Factor = "(" Expression ")" . Factor = "+" Factor . Factor = "-" Factor . Factor = Constant . Constant = "0" . Constant = "1" . ... Constant = "9" . |
Wenn eine Grammatik vorgegeben ist, lassen sich leicht entsprechend der Produktionsregeln zulässige Sätze bilden:
Expression | Startsymbol |
Term "+" Expression | Expression = Term "+" Expression |
Factor "+" Expression | Term = Factor |
Constant "+" Expression | Factor = Constant |
"1" "+" Expression | Constant = "1" |
"1" "+" Term | Expression = Term |
"1" "+" Factor "*" Term | Term = Factor "*" Term |
"1" "+" Constant "*" Term | Factor = Constant |
"1" "+" "2" "*" Term | Constant = "2" |
"1" "+" "2" "*" Factor | Term = Factor |
"1" "+" "2" "*" Constant | Factor = Constant |
"1" "+" "2" "*" "3" | Constant = "3" |
Copyright © 1999 Andreas Borchert, in HTML konvertiert am 29.06.1999 |