Разработка транслятора с языка PROST на язык С++. Часть 2., страница 4

V23 = V22 U { label | op_label → label <identifer> ; є P; op_label є V22} = { code OPERATORS, operator, end, op_assignment, op_while, op_input, op_outputn, op_outputs, OP_LABEL, OP_IF, <identifer>,:=, expression, ; , while, condition, do, input, outputn, outputs, <strc>,  goto, label }

V24 = V23 U { if | op_if → if ( expression condition expression ) then operators ELSE є P; op_if є V22} = { code OPERATORS, operator, end, op_assignment, op_while, op_input, op_outputn, op_outputs, OP_LABEL, OP_IF, <identifer>,:=, expression, ; , while, condition, do, input, outputn, outputs, <strc>,  goto, label, if }

V25 = V24 U { then | op_if → if ( expression condition expression ) then operators ELSE є P; op_if є V24} = { code OPERATORS, operator, end, op_assignment, op_while, op_input, op_outputn, op_outputs, OP_LABEL, OP_IF, <identifer>,:=, expression, ; , while, condition, do, input, outputn, outputs, <strc>,  goto, label, if, then }

V26 = V25 U { ELSE | op_if → if ( expression condition expression ) then operators ELSE є P; op_if є V25} = { code OPERATORS, operator, end, op_assignment, op_while, op_input, op_outputn, op_outputs, OP_LABEL, OP_IF, <identifer>,:=, expression, ; , while, condition, do, input, outputn, outputs, <strc>,  goto, label, if, then, ELSE }

V27 = V26 U { else | ELSE → else operators є P; ELSE є V26} = { code OPERATORS, operator, end, op_assignment, op_while, op_input, op_outputn, op_outputs, OP_LABEL, OP_IF, <identifer>,:=, expression, ; , while, condition, do, input, outputn, outputs, <strc>,  goto, label, if, then, ELSE, else }

Недостижимыми являются символы: op_for, for, op_switch, switch, switch_body, switch_statement,case ,op_break, break, op_continue, continue, op_call, call, op_return, return

2.1.3.5 Устранение бесполезных символов.

N0 = ø

N1 = {unop|UNOP → - Є P, - Є T}

U N0

= {unop}

N2 = N1 U {BINOP|BINOP → + Є P, + Є T}

= {unop, binop}

N3 = N2 U {CONDITION| CONDITION → < Є P, < Є T}

= {unop, binop, condition}

N4 = N3 U {EXPRESSION|EXPRESSION → <const> Є P, <const> Є T}

= {unop, binop, condition, expression}

N5 = N4 U { op_input | op_input → input <identifer> ; Є P, input <identifer> ; Є T}

= {unop, binop, condition, expression, op_input}

N6 = N5 U { op_outputs | op_outputs → outputs <strc> ; Є P, outputs <strc> ; Є T}

= {unop, binop, condition, expression, op_input, op_outputs}

N7 = N6 U { op_label | op_label → label <identifer> ; Є P, label <identifer> ; Є T}

= {unop, binop, condition, expression, op_input, op_outputs, op_label}

N8 = N7 U { op_goto | op_goto → goto <identifer> ; Є P, goto <identifer> ; Є T}

= {unop, binop, condition, expression, op_input, op_outputs, op_label, op_goto}

N9 = N8 U { operators | operators → end Є P, end Є T}

= {unop, binop, condition, expression, op_input, op_outputs, op_label, op_goto, operators}

N10 = { N9 u {ex|ex → - <const> Є p,- <const> Є (n9 u t)}

= {unop, binop, condition, expression, op_input, op_outputs, op_label, op_goto, operators, EX}

n11 = N10 U {op_assignment | op_assignment → <identifer> := <const> ; Є P, <identifer> := <const> ; Є (n10 u t)}

= {unop, binop, condition, expression, op_input, op_outputs, op_label, op_goto, operators, EX, op_assignment}

n12 = n11 U {op_outputn | op_outputn → outputn <const> ;, outputn <const> ; Є (n11 U T)}

= {unop, binop, condition, expression, op_input, op_outputs, op_label, op_goto, operators, EX, op_assignment, op_outputn}

n13 = n12 U {op_while | op_while → while (<const> < <const>) do end Є p, while (<const> < <const>) do end Є (n12 U T)}

= {unop, binop, condition, expression, op_input, op_outputs, op_label, op_goto, operators, EX, op_assignment, op_outputn, op_while}

n14 = n13 U {ELSE | ELSE → else end Є p, else end Є (n13 U T)}

= {unop, binop, condition, expression, op_input, op_outputs, op_label, op_goto, operators, EX, op_assignment, op_outputn, op_while, ELSE}