snit::type a_pe_grammar {
    constructor {} {
        install myg using pt::peg::container ${selfns}::G
        $myg start {n Expression}
        $myg add   AddOp Digit Expression Factor Function MulOp Number Sign Sinus Term
        $myg modes {
            AddOp      value
            Digit      value
            Expression value
            Factor     value
            Function   value
            MulOp      value
            Number     value
            Sign       value
            Sinus      value
            Term       value
        }
        $myg rules {
            AddOp      {/ {t -} {t +}}
            Digit      {/ {t 0} {t 1} {t 2} {t 3} {t 4} {t 5} {t 6} {t 7} {t 8} {t 9}}
            Expression {/ {n Function} {/ {x {t \50} {n Expression} {t \51}} {x {n Factor} {* {x {n MulOp} {n Factor}}}}}}
            Factor     {x {n Term} {* {x {n AddOp} {n Term}}}}
            Function   {n Sinus}
            MulOp      {/ {t *} {t /}}
            Number     {x {? {n Sign}} {+ {n Digit}}}
            Sign       {/ {t -} {t +}}
            Sinus      {x {t s} {t i} {t n} {t \50} {n Expression} {t \51}}
            Term       {n Number}
        }
        return
    }

    component myg
    delegate method * to myg
}
