[http://www.aistudy.com/linguistics/chomsky_hierarchy.htm Chomsky Hierarchy 참고] {{{ < EBNF > Expr ::= Term([+|-] Expr)? Term ::= Factor ([*|/] Term)? Factor :: = (Expr) | Value Value ::= Integer | Double < > Expr ::= Term (s) expr.isDouble = term.isDouble (i) term.type = if expr.isDouble then double else int Expr1 ::= Term [+-] Expr2 (s) expr1.isDouble = term.isDouble or expr2.isDouble (i) term.type = expr1.isDouble then double else int (i) expr2.type = expr1.isDouble then double else int Factor ::= (Expr) (s) factor.isDouble = expr.isDouble (i) expr.type = factor.isDouble then double else int Factor ::= Value (s) factor.isDouble = value.isDouble (i) value.type = factor.isDouble then double else int Value :: Decimal Integer (s) value.isDouble = false (i) value.type = value.type == double then double else int Value :: Double (s) value.isDouble = true (i) value.type = value.type == double then double else int }}}