$ENTRY Go { = <Prout <Diff <Spar '(x)sin(x)*cos(x)+1/x'>>>; } Spar { e.1 = <Spar1 ('*') e.1>; } Spar1 { (e.1) '('e.3 = <Spar1 ((e.1)) e.3>; ((e.1) e.2) ')' e.3 = <Spar1 (e.1 (e.2)) e.3>; ('*' e.1) ')' e.3 = 'error' e.1 ')' e.3; (e.1) s.A e.3 = <Spar1 (e.1 s.A) e.3>; ('*' e.1) = e.1; ((e.1) e.2) = 'error' e.1 '(' e.2; } * * Спаривание скобок * ------------------------------------------- Diff { (e.t) e.1 '+' e.2 = <Diff (e.t) e.1> '+' <Diff (e.t) e.2>; (e.t) e.1 '-' e.2 = <Diff (e.t) e.1> '-' <Diff (e.t) e.2>; (e.t) e.1 '*' e.2 = (e1 '*' <Diff (e.t) e.2> '+' <Diff (e.t) e.1> '*' e.2); (e.t) e.1 '/' e.2 = (( <Diff (e.t) e.1> '*' e.2 '-' e.1 '*' <Diff (e.t) e.2>) '/' (e.2 '*' e.2) ); (e.t) e.1 '^' e.2 = (e.1 '^' (e.2 '-1' )) '*' <Diff (e.t) e.1>; (e.t) 'sin'(e.1) = 'cos' (e.1) '*' (<Diff (e.t) e.1>); (e.t) 'cos'(e.1) = ('-sin' (e.1)) '*' (<Diff (e.t) e.1>); (e.t) 'Ґеа'(e.1) = 'Ґеа' (e.1) '*' (<Diff (e.t) e.1>); (e.t) (e.1) = ( <Diff (e.t) e.1> ); (e.t) e.t = '1'; (e.t) e.1 = '0'; } * * Дифференцирование *