Benutzer:Grey/pss: Unterschied zwischen den Versionen
(→Milstone 1) |
(→BNF) |
||
Zeile 12: | Zeile 12: | ||
== BNF == | == BNF == | ||
+ | Erste Umformung: | ||
+ | Prog -> Def # <br> | ||
+ | Def -> Def Def' | ||
+ | | Def'<br> | ||
+ | Def' -> <u>DEF</u> Lhs <u>==</u> Expr<br> | ||
+ | Lhs -> <u>MAIN</u> <u>:</u> Type | ||
+ | | <u>id</u> <u>(</u> Lhs' <u>)</u> <u>:</u> Type<br> | ||
+ | Lhs' -> <u>id</u> <u>:</u> Type A'<br> | ||
+ | A' -> <u>,</u> <u>id</u> <u>:</u> Type A' | ||
+ | | e<br> | ||
+ | Type -> <u>nat</u> | ||
+ | | <u>bool</u><br> | ||
+ | Expr -> Value | ||
+ | | <u>id</u> <u>(</u> Expr' <u>)</u> | ||
+ | | <u>IF</u> Expr <u>THEN</u> Expr E <u>FI</u><br> | ||
+ | Expr' -> Expr Expr' | ||
+ | | <u>,</u> Expr Expr' | ||
+ | | e<br> | ||
+ | E -> <u>ELSE</u> Expr | ||
+ | | e<br> | ||
+ | Value -> <u>number</u> | ||
+ | | <u>true</u> | ||
+ | | <u>false</u> | ||
[[Kategorie:GREY-PSS]] | [[Kategorie:GREY-PSS]] |
Version vom 22. November 2005, 02:22 Uhr
Milstone 1
- EBNF in BNF Grammatik umwandeln:
EBNF
Gegeben ist folgende EBNF Syntax von microOPAL:
Prog -> Def Def * # Def -> DEF Lhs == Expr Lhs -> MAIN : Type | id ( [id : Type (, id : Type)*]) : Type Type -> nat | bool Expr -> number | true | false | id [ ( [Expr (, Expr)*] ) ] | IF Expr THEN Expr [ELSE Expr] FI
BNF
Erste Umformung:
Prog -> Def #
Def -> Def Def' | Def'
Def' -> DEF Lhs == Expr
Lhs -> MAIN : Type | id ( Lhs' ) : Type
Lhs' -> id : Type A'
A' -> , id : Type A' | e
Type -> nat | bool
Expr -> Value | id ( Expr' ) | IF Expr THEN Expr E FI
Expr' -> Expr Expr' | , Expr Expr' | e
E -> ELSE Expr | e
Value -> number | true | false