== LL(1) parser == * 처음 한 글자를 보고 구분할 수 있어야 함. * LL(1) parser에서 불가능한 경우 * A ::= AB (left recursive가 발생하기 때문에 처리 불가.) elimination 필요. * A ::= BC | BD (left common prefix로 첫 글자인 B하나만으로 두 경우의 구분이 불가.) factorization 필요. == EBNF == [http://www.aistudy.com/linguistics/chomsky_hierarchy.htm Chomsky Hierarchy 참고] {{{ < EBNF > Expr ::= Term([+|-] Expr)? Term ::= Factor ([*|/] Term)? Factor :: = (Expr) | Value Value ::= Integer | Double }}} {{{ s : synthesis i : inherit < Synthesis, Inherit > 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 }}}