% Remember to use the lgrind style

\Head{}
\File{calculation.pas}{2007}{4}{15}{22:35}{27275}
\L{\LB{\K{unit}_\V{calculation};}}
\L{\LB{}}
\L{\LB{\C{}\{\$mode_objfpc\}\CE{}\C{}\{\$H+\}\CE{}}}
\L{\LB{\C{}\{\$Q+\}\CE{}}}
\L{\LB{\K{interface}}}
\L{\LB{}}
\L{\LB{\K{uses}}}
\L{\LB{}\Tab{2}{\V{Classes},_\V{SysUtils},\V{math};}}
\L{\LB{}}
\L{\LB{\K{type}}}
\L{\LB{}\Tab{2}{\V{intnumber}=\V{int64};_\C{}//Typ_für_ein_Folgenelement\CE{}}}
\L{\LB{}\Tab{2}{\V{Pintnumber}=\5\V{intnumber};}}
\L{\LB{}\Tab{2}{\V{TSequenceValueBlock}=\K{array}[\N{0}\V{.\,.100000}]_\K{of}_\V{int64};_\C{}//Eine_lange_Folge\CE{}}}
\L{\LB{}\Tab{2}{\V{PSequenceValueBlock}=\5\V{TSequenceValueBlock};}\Tab{49}{\C{}//Zeiger_auf_das_erste_Element\CE{}}}
\L{\LB{}\Tab{2}{\V{TOutputMode}_=_(\V{omNormal},_\V{omDerive},_\V{omLatex});_\C{}//Gibt_die_Ausgabeart_an\CE{}}}
\L{\LB{}}
\L{\LB{}\Tab{2}{\C{}\{_TMathExpressionNode_\}\CE{}}}
\L{\LB{}\Tab{2}{\C{}//Mathematische_Operatoren_mit_konstanter_Folge_und_Zugriff_auf_frühere_Elemente\CE{}}}
\L{\LB{}\Tab{2}{\V{TMathFunction}=(\V{mfbase1},\V{mfbasePre1},\V{mfbasePre2},\V{mfbinaryAdd},\V{mfbinarySub},\V{mfbinaryMul});}}
\L{\LB{}\Tab{2}{\C{}//Stellt_einen_Knoten_des_Syntaxbaums_dar\CE{}}}
\L{\LB{}\Tab{2}{\V{TMathExpressionNode}=\K{class}}}
\L{\LB{}\Tab{2}{\K{private}}}
\L{\LB{}\Tab{4}{\V{refcount}:_\V{longint};}\Tab{30}{\C{}//Referenzzähler_(Warum_nur_hat_FPC_keinen_GC:-()\CE{}}}
\L{\LB{}\Tab{2}{\K{public}}}
\L{\LB{}\Tab{4}{\V{typ}:_\V{TMathFunction};}\Tab{30}{\C{}//Operator\CE{}}}
\L{\LB{}\Tab{4}{\V{a},\V{b}:_\V{TMathExpressionNode};_\C{}//Ausdrücke_auf_die_der_Operator_angewendet_wird\CE{}}}
\L{\LB{}\Tab{4}{\V{initSize},}\Tab{30}{\C{}//Anzahl_der_Startwerte\CE{}}}
\L{\LB{}\Tab{4}{\V{pre1Count},\V{pre2Count}:_\V{longint};\C{}//Vorfaktoren_bei_Zugriff_auf_frühere_Elemente\CE{}}}
\L{\LB{}\Tab{4}{\V{numberValue}:_\V{intnumber};}\Tab{30}{\C{}//Zahlenwert,_wenn_der_Ausdruck_konstant_ist\CE{}}}
\L{\LB{}\Tab{4}{\V{seqRealLen}:\V{longint};}\Tab{30}{\C{}//Länge_einer_durch_diesen_Ausdruck_bestimmten_Folge\CE{}}}
\index{create}\Proc{create}\L{\LB{}\Tab{4}{\K{constructor}_\V{create}();}}
\index{create}\Proc{create}\L{\LB{}\Tab{4}{\K{constructor}_\V{create}(\V{\_typ}:_\V{TMathFunction});}}
\L{\LB{}\Tab{4}{\C{}//Setzt_die_übergebenen_Werte_und_überprüft_sie\CE{}}}
\index{make}\Proc{make}\L{\LB{}\Tab{4}{\K{function}_\V{make}(\V{\_typ}:_\V{TMathFunction};\V{\_a},\V{\_b}:\V{TMathExpressionNode}):\V{boolean};}}
\L{\LB{}\Tab{4}{\C{}//Berechnet_einen_Folgenwert\CE{}}}
\index{calculate}\Proc{calculate}\L{\LB{}\Tab{4}{\K{function}_\V{calculate}(\V{seq}:_\V{PSequenceValueBlock}):\V{intnumber};}}
\L{\LB{}\Tab{4}{\C{}//Liest_den_Ausdruck\CE{}}}
\index{readFromStream}\Proc{readFromStream}\L{\LB{}\Tab{4}{\K{procedure}_\V{readFromStream}(\V{stream}:\V{TStream});}}
\L{\LB{}\Tab{4}{\C{}//Speichert_den_Ausdruck\CE{}}}
\index{writeToStream}\Proc{writeToStream}\L{\LB{}\Tab{4}{\K{function}_\V{writeToStream}(\V{stream}:\V{TStream}):_\V{longint};}}
\L{\LB{}\Tab{4}{\C{}//Wandelt_ihn_in_einen_String_für_Funktion_namens_functionName_um\CE{}}}
\index{toString}\Proc{toString}\L{\LB{}\Tab{4}{\K{function}_\V{toString}(\V{outputMode}:_\V{TOutputMode};_\V{functionName}:_\V{string}):\V{string};}}
\index{freeChildren}\Proc{freeChildren}\L{\LB{}\Tab{4}{\K{procedure}_\V{freeChildren};_\C{}//Gibt_die_Unterknoten_a_und_b_frei\CE{}}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{toString}\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}\Tab{2}{\C{}\{_TSequenceCreator_\}\CE{}}}
\L{\LB{}\Tab{2}{}}
\L{\LB{}\Tab{2}{\C{}//Eine_abstrakte_Folgedefinition\CE{}}}
\L{\LB{}\Tab{2}{\V{TSequenceCreator}=\K{class}}}
\L{\LB{}\Tab{4}{\V{refcount}:_\V{longint};\C{}//Referenzzähler\CE{}}}
\L{\LB{}\Tab{4}{\V{values}:_\V{PSequenceValueBlock};_\C{}//Die_Folgenwerte\CE{}}}
\L{\LB{}\Tab{4}{\V{realLen}:\V{longint};}\Tab{33}{\C{}//Die_echte_Länge_der_Folge\CE{}}}
\L{\LB{}\Tab{4}{\C{}//Berechnet_die_Werte_in_values_aus_der_Folgendefinition\CE{}}}
\index{calculate}\Proc{calculate}\L{\LB{}\Tab{4}{\K{procedure}_\V{calculate}(\V{len}:\V{longint});\K{virtual};\V{abstract};}}
\L{\LB{}\Tab{4}{\C{}//Liest_die_Folgendefinition\CE{}}}
\index{readFromStream}\Proc{readFromStream}\L{\LB{}\Tab{4}{\K{procedure}_\V{readFromStream}(\V{stream}:\V{TStream});\K{virtual};\V{abstract};}}
\L{\LB{}\Tab{4}{\C{}//Speichert_die_Folgendefinition\CE{}}}
\index{writeToStream}\Proc{writeToStream}\L{\LB{}\Tab{4}{\K{function}_\V{writeToStream}(\V{stream}:\V{TStream}):_\V{longint};\K{virtual};\V{abstract};}}
\L{\LB{}\Tab{4}{\C{}//Gibt_alle_mit_diesem_Objekt_verbundenen_Objekte_frei\CE{}}}
\index{freeChildren}\Proc{freeChildren}\L{\LB{}\Tab{4}{\K{procedure}_\V{freeChildren};\K{virtual};\V{abstract};}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{writeToStream}\L{\LB{}}
\L{\LB{}\Tab{2}{\C{}\{_TRecursiveExpression_\}\CE{}}}
\L{\LB{}}
\L{\LB{}\Tab{2}{\C{}//Folgedefinition_über_Rekursion\CE{}}}
\L{\LB{}\Tab{2}{\V{TRecursiveExpression}=\K{class}(\V{TSequenceCreator})}}
\L{\LB{}\Tab{4}{\V{expr}:_\V{TMathExpressionNode};}}
\L{\LB{}\Tab{4}{\V{valueStart}:_\K{array}[\N{0}\V{.\,.1}]_\K{of}_\V{intnumber};}}
\index{create}\Proc{create}\L{\LB{}\Tab{4}{\K{constructor}_\V{create}();}}
\index{calculate}\Proc{calculate}\L{\LB{}\Tab{4}{\K{procedure}_\V{calculate}(\V{len}:_\V{longint});\K{override};}}
\index{readFromStream}\Proc{readFromStream}\L{\LB{}\Tab{4}{\K{procedure}_\V{readFromStream}(\V{stream}:\V{TStream});\K{override};}}
\index{writeToStream}\Proc{writeToStream}\L{\LB{}\Tab{4}{\K{function}_\V{writeToStream}(\V{stream}:\V{TStream}):_\V{longint};\K{override};}}
\L{\LB{}\Tab{4}{\C{}//Gibt_die_Definition_aus_und_benutzt_dabei_den_angegeben_Funktionsnamen\CE{}}}
\index{toString}\Proc{toString}\L{\LB{}\Tab{4}{\K{function}_\V{toString}(\V{outputMode}:_\V{TOutputMode};}}
\L{\LB{}\Tab{22}{\V{functionName}:_\V{string}):\V{string};}}
\index{freeChildren}\Proc{freeChildren}\L{\LB{}\Tab{4}{\K{procedure}_\V{freeChildren};\K{override};_\C{}//Löscht_expr_und_alle_weiteren_Ausdrücke\CE{}}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{toString}\L{\LB{}}
\L{\LB{}\Tab{2}{\C{}\{TSequenceOperator\}\CE{}}}
\L{\LB{}}
\L{\LB{}\Tab{2}{\V{TSeqFunction}=(\V{sfbase1},\V{sfbase2},\V{sfbase5},_\C{}//Konstante_Folgen\CE{}}}
\L{\LB{}\Tab{16}{\V{sfunarySum},\V{sfUnaryMul},}\Tab{41}{\C{}//unäre_Operatoren\CE{}}}
\L{\LB{}\Tab{16}{\V{sfbinaryAdd},\V{sfbinarySub},\V{sfbinaryMul},\V{sfbinaryPower}\C{}//binäre_Op.\CE{}}}
\L{\LB{}\Tab{16}{);}}
\L{\LB{}\Tab{2}{\C{}//Folgedefinition_über_Folgenoperatoren\CE{}}}
\L{\LB{}\Tab{2}{\V{TSequenceOperator}=\K{class}(\V{TSequenceCreator})}}
\L{\LB{}\Tab{4}{\V{typ}:_\V{TSeqFunction};}\Tab{27}{\C{}//anzuwendende_Rechenoperation\CE{}}}
\L{\LB{}\Tab{4}{\V{a},\V{b}:_\V{TSequenceCreator};_\C{}//Folgen,_auf_die_diese_angewendet_werden\CE{}}}
\L{\LB{}\Tab{4}{\V{numberOnly}:_\V{boolean};}\Tab{27}{\C{}//Ist_die_Folge_konstant?\CE{}}}
\L{\LB{}\Tab{4}{\V{numberValue}:\V{intnumber};_\C{}//Wenn_ja,_der_konstante_Wert\CE{}}}
\index{create}\Proc{create}\L{\LB{}\Tab{4}{\K{constructor}_\V{create};}}
\index{create}\Proc{create}\L{\LB{}\Tab{4}{\K{constructor}_\V{create}(\V{\_typ}:\V{TSeqFunction};\V{\_a},\V{\_b}:\V{TSequenceCreator});}}
\index{update}\Proc{update}\L{\LB{}\Tab{4}{\K{procedure}_\V{update};}\Tab{27}{\C{}//Überprüft,_ob_die_Folge_konstant_ist\CE{}}}
\index{equal}\Proc{equal}\L{\LB{}\Tab{4}{\K{function}_\V{equal}(\V{so}:\V{TSequenceOperator}):\V{boolean};_\C{}//Vergleicht_zwei_Folgen\CE{}}}
\L{\LB{}\Tab{4}{\C{}//Berechnet_die_Folge_aus_den_Variablen_typ,_a_und_b\CE{}}}
\index{calculate}\Proc{calculate}\L{\LB{}\Tab{4}{\K{procedure}_\V{calculate}(\V{len}:_\V{longint});\K{override};}}
\index{readFromStream}\Proc{readFromStream}\L{\LB{}\Tab{4}{\K{procedure}_\V{readFromStream}(\V{stream}:\V{TStream});\K{override};}}
\index{writeToStream}\Proc{writeToStream}\L{\LB{}\Tab{4}{\K{function}_\V{writeToStream}(\V{stream}:\V{TStream}):_\V{longint};\K{override};}}
\L{\LB{}\Tab{4}{\C{}//Wandelt_die_Definition_in_einen_String,_abhängig_von_der_angegebenen\CE{}}}
\L{\LB{}\Tab{4}{\C{}//Variable_um._Zu_functions_werden_alle_benötigten_rekursiv_Folgen_hinzugefügt\CE{}}}
\index{toString}\Proc{toString}\L{\LB{}\Tab{4}{\K{function}_\V{toString}(\V{outputMode}:_\V{TOutputMode};_\V{variable}:_\V{longint};}}
\L{\LB{}\Tab{22}{\K{var}_\V{functions}:_\V{string};}}
\L{\LB{}\Tab{22}{\K{var}_\V{functionCount}:_\V{longint}):\V{string};}}
\index{freeChildren}\Proc{freeChildren}\L{\LB{}\Tab{4}{\K{procedure}_\V{freeChildren};\K{override};_\C{}//Gibt_a_und_b_frei\CE{}}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}}
\L{\LB{}\Tab{2}{\C{}\{_TSequenceInfo_\}\CE{}}}
\L{\LB{}\Tab{2}{\C{}//Speichert_die_Definition_einer_Folge\CE{}}}
\L{\LB{}\Tab{2}{\V{TSequenceInfo}=\K{class}}}
\L{\LB{}\Tab{4}{\V{values}:_\V{PSequenceValueBlock};}\Tab{40}{\C{}//Werte_der_Folge\CE{}}}
\L{\LB{}\Tab{4}{\V{id},\V{len}:_\V{longint};}\Tab{40}{\C{}//Nummer_und_Länge\CE{}}}
\L{\LB{}\Tab{4}{\V{recursive}:\V{TRecursiveExpression};}\Tab{40}{\C{}//Rekursive_Definition_falls_vorhanden\CE{}}}
\L{\LB{}\Tab{4}{\V{sequenceOperator}:\V{TSequenceOperator};_\C{}//Definition_durch_Operatoren}\Tab{71}{\3_\3\CE{}}}
\L{\LB{}\Tab{4}{\V{standAlone}:_\V{boolean};}\Tab{40}{\C{}//Keine_gemeinsame_Speichernutzung\CE{}}}
\L{\LB{}\Tab{4}{\V{suffixStart}:_\V{longint};}\Tab{40}{\C{}//Startposition_der_gesuchten_Folge\CE{}}}
\index{print}\Proc{print}\L{\LB{}\Tab{4}{\K{procedure}_\V{print}(\V{outputMode}:_\V{TOutputMode});\C{}//Gibt_die_Folge_und_Definition_aus\CE{}}}
\index{readFromStream}\Proc{readFromStream}\L{\LB{}\Tab{4}{\K{procedure}_\V{readFromStream}(\V{stream}:\V{TStream});\C{}//Lädt_die_Definitionen\CE{}}}
\index{writeToStream}\Proc{writeToStream}\L{\LB{}\Tab{4}{\K{function}_\V{writeToStream}(\V{stream}:\V{TStream}):_\V{longint};\C{}//Speichert_die_Definitionen\CE{}}}
\index{destroy}\Proc{destroy}\L{\LB{}\Tab{4}{\K{destructor}_\V{destroy};\K{override};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\K{const}_\V{INT\_NAN}:\V{intnumber}=\-\N{9223372036854775808};_\C{}//Wert_für_undefinierte_Zahlen\CE{}}}
\L{\LB{}\Tab{6}{\V{NORMAL\_INT\_NAN}:\V{longint}=\V{MaxInt};}\Tab{46}{\C{}//_\3}\Tab{54}{\3}\Tab{63}{\3}\Tab{71}{\3\CE{}}}
\L{\LB{}\Tab{6}{\V{MIN\_SEQ\_LEN}}\Tab{22}{=_\N{10};}\Tab{46}{\C{}//Mindestlänge_einer_Folge\CE{}}}
\L{\LB{}\Tab{6}{\V{REC\_CREATION\_ID}_=_\N{\$1};}\Tab{29}{\C{}//Nummer_für_eine_rekursiv_definierte_Folge\CE{}}}
\L{\LB{}\Tab{6}{\V{SEQ\_CREATION\_ID}_=_\N{\$2};}\Tab{29}{\C{}//Nummer_für_eine_durch_Operatoren_definierte_Folge\CE{}}}
\L{\LB{}\Tab{6}{\C{}//Alle_möglichen_Variablenamen_in_der_Reihenfolge_ihrer_Verwendung\CE{}}}
\L{\LB{}\Tab{6}{\V{VARIABLE\_NAMES}:\V{string}=\S{}{'}nijklrstuvwmxyzabcdefghopqABCDEFGHIJKLMNOPQRSTUVWXYZ{'}\SE{};}}
\L{\LB{\K{implementation}}}
\L{\LB{}}
\L{\LB{\C{}\{_TMathExpressionNode_\}\CE{}}}
\L{\LB{}}
\index{TMathExpressionNode.create}\Proc{TMathExpressionNode.create}\L{\LB{\K{constructor}_\V{TMathExpressionNode.create}();}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{refcount}:=\N{1};}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//Konstruktor_für_Basisausdrücke\CE{}}}
\index{TMathExpressionNode.create}\Proc{TMathExpressionNode.create}\L{\LB{\K{constructor}_\V{TMathExpressionNode.create}(\V{\_typ}:_\V{TMathFunction});}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{refcount}:=\N{1};}}
\L{\LB{}\Tab{2}{\V{make}(\V{\_typ},\K{nil},\K{nil});}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\C{}//Setzt_die_übergebenen_Werte_und_überprüft_sie\CE{}}}
\L{\LB{\C{}//Hierzu_wird_die_Zahl_der_Startwerte_aus_a_und_b_übernommen\CE{}}}
\L{\LB{\C{}//Die_Vorfaktoren_der_Zugriffe_auf_frühere_Elemente_ermittelt_und_entsprechend\CE{}}}
\L{\LB{\C{}//kombiniert._(addiert_bei_Addition,_.\,.\,._)\CE{}}}
\L{\LB{\C{}//Stellt_sich_heraus,_dass_einer_Vorfaktoren_0_ergibt,_ist_die_Konstruktion\CE{}}}
\L{\LB{\C{}//sinnlos._Weiterhin_wird_überprüft,_ob_die_Folge_konstant_ist\CE{}}}
\index{TMathExpressionNode.make}\Proc{TMathExpressionNode.make}\L{\LB{\K{function}_\V{TMathExpressionNode.make}(\V{\_typ}:_\V{TMathFunction};_\V{\_a},}}
\L{\LB{}\Tab{2}{\V{\_b}:_\V{TMathExpressionNode}):\V{boolean};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{typ}:=\V{\_typ};}}
\L{\LB{}\Tab{2}{\V{a}:=\V{\_a};}}
\L{\LB{}\Tab{2}{\V{b}:=\V{\_b};}}
\L{\LB{}\Tab{2}{\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{4}{\C{}//Basisausdrücke_(konstanter_Wert,_Zugriff_auf_frühere_Elemente)\CE{}}}
\L{\LB{}\Tab{4}{\V{mfbase1}:_\K{begin}}}
\L{\LB{}\Tab{6}{\V{initSize}:=\N{0};}}
\L{\LB{}\Tab{6}{\V{numberValue}:=\N{1};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\V{mfbasePre1}:_\K{begin}}}
\L{\LB{}\Tab{6}{\V{initSize}:=\N{1};}}
\L{\LB{}\Tab{6}{\V{pre1Count}:=\N{1};}}
\L{\LB{}\Tab{6}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\V{mfbasePre2}:_\K{begin}}}
\L{\LB{}\Tab{6}{\V{initSize}:=\N{2};}}
\L{\LB{}\Tab{6}{\V{pre2Count}:=\N{1};}}
\L{\LB{}\Tab{6}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\C{}//Binäre_Operatoren\CE{}}}
\L{\LB{}\Tab{4}{\K{else}_\K{begin}}}
\L{\LB{}\Tab{6}{\K{if}_\V{a.initSize}\>\V{b.initSize}_\K{then}_\V{initSize}:=\V{a.initSize}}}
\L{\LB{}\Tab{6}{\K{else}_\V{initSize}:=\V{b.initSize};}}
\L{\LB{}\Tab{6}{\C{}//Vorfaktor_für_das_vorherige_Element\CE{}}}
\L{\LB{}\Tab{6}{\K{if}_(\V{a.pre1Count}=\V{NORMAL\_INT\_NAN})_\K{or}_(\V{b.pre1Count}=\V{NORMAL\_INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{8}{\V{pre1Count}:=\V{NORMAL\_INT\_NAN}}}
\L{\LB{}\Tab{7}{\K{else}_\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{8}{\V{mfbinaryAdd}:_\V{pre1Count}:=\V{a.pre1Count}+\V{b.pre1Count};}}
\L{\LB{}\Tab{8}{\V{mfbinarySub}:_\V{pre1Count}:=\V{a.pre1Count}\-\V{b.pre1Count};}}
\L{\LB{}\Tab{8}{\V{mfbinaryMul}:_\V{pre1Count}:=\V{NORMAL\_INT\_NAN};}}
\L{\LB{}\Tab{7}{\K{end};}}
\L{\LB{}\Tab{6}{\C{}//Vorfaktor_für_das_vorvorherige\CE{}}}
\L{\LB{}\Tab{6}{\K{if}_(\V{a.pre2Count}=\V{NORMAL\_INT\_NAN})_\K{or}_(\V{b.pre2Count}=\V{NORMAL\_INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{8}{\V{pre2Count}:=\V{NORMAL\_INT\_NAN}}}
\L{\LB{}\Tab{7}{\K{else}_\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{8}{\V{mfbinaryAdd}:_\V{pre2Count}:=\V{a.pre2Count}+\V{b.pre2Count};}}
\L{\LB{}\Tab{8}{\V{mfbinarySub}:_\V{pre2Count}:=\V{a.pre2Count}\-\V{b.pre2Count};}}
\L{\LB{}\Tab{8}{\V{mfbinaryMul}:_\V{pre2Count}:=\V{NORMAL\_INT\_NAN};}}
\L{\LB{}\Tab{7}{\K{end};}}
\L{\LB{}\Tab{6}{\C{}//Überprüfung_auf_Konstanz\CE{}}}
\L{\LB{}\Tab{6}{\K{if}_(\V{initSize}=\N{0})_\K{and}_(\V{a.numberValue}\<\>\V{INT\_NAN})_\K{and}_(\V{b.numberValue}\<\>\V{INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{8}{\V{numberValue}:=\V{a.numberValue}+\V{b.numberValue}}}
\L{\LB{}\Tab{7}{\K{else}}}
\L{\LB{}\Tab{8}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\C{}//Überprüfung_auf_verschwindende_Vorfaktoren\CE{}}}
\L{\LB{}\Tab{2}{\V{result}:=(\V{pre1Count}\<\>\N{0})_\K{and}}}
\L{\LB{}\Tab{10}{((\V{pre2Count}\<\>\N{0})_\K{or}_(\V{initSize}\<\N{2}));}}
\L{\LB{\K{end};}}
\ProcCont{equal}\L{\LB{}}
\L{\LB{\C{}//Berechnet_ein_Element_einer_Folge_und_gibt_den_Wert_zurück\CE{}}}
\L{\LB{\C{}//seq\5[0]_sollte_das_aktuelle_Element_sein_seq\5[-1]_das_vorherige_.\,.\,.\CE{}}}
\index{TMathExpressionNode.calculate}\Proc{TMathExpressionNode.calculate}\L{\LB{\K{function}_\V{TMathExpressionNode.calculate}(\V{seq}:_\V{PSequenceValueBlock}):_\V{intnumber};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{numberValue}\<\>\V{INT\_NAN}_\K{then}_\K{exit}(\V{numberValue});}}
\L{\LB{}\Tab{2}{\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{4}{\V{mfbase1}:}\Tab{16}{\V{result}:=\N{1};}}
\L{\LB{}\Tab{4}{\V{mfbasePre1}:_\V{result}:=(\V{Pintnumber}(\V{seq})\-\N{1})\5;}}
\L{\LB{}\Tab{4}{\V{mfbasePre2}:_\V{result}:=(\V{Pintnumber}(\V{seq})\-\N{2})\5;}}
\L{\LB{}\Tab{4}{\V{mfbinaryAdd}:_\V{result}:=\V{a.calculate}(\V{seq})+\V{b.calculate}(\V{seq});}}
\L{\LB{}\Tab{4}{\V{mfbinarySub}:_\V{result}:=\V{a.calculate}(\V{seq})\-\V{b.calculate}(\V{seq});}}
\L{\LB{}\Tab{4}{\V{mfbinaryMul}:_\V{result}:=\V{a.calculate}(\V{seq})*\V{b.calculate}(\V{seq});}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{equal}\L{\LB{\K{end};}}
\ProcCont{update}\L{\LB{}}
\L{\LB{\C{}//Liest_den_Ausdruck_aus_einer_Datei\CE{}}}
\index{TMathExpressionNode.readFromStream}\Proc{readFromStream}\L{\LB{\K{procedure}_\V{TMathExpressionNode.readFromStream}(\V{stream}:_\V{TStream});}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{typ}:=\V{TMathFunction}(\V{stream.ReadByte});}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{mfbinaryAdd}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\C{}//Bei_einer_binären_Operation_Teilausdrücke_laden\CE{}}}
\L{\LB{}\Tab{4}{\V{a}:=\V{TMathExpressionNode.Create};}}
\L{\LB{}\Tab{4}{\V{b}:=\V{TMathExpressionNode.Create};}}
\L{\LB{}\Tab{4}{\V{a.readFromStream}(\V{stream});}}
\L{\LB{}\Tab{4}{\V{b.readFromStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{update}\L{\LB{}\Tab{2}{\C{}//Überprüfen_(konstanten_Wert_ermitteln,_falls_vorhanden)\CE{}}}
\L{\LB{}\Tab{2}{\V{make}(\V{typ},\V{a},\V{b});}}
\L{\LB{\K{end};}}
\ProcCont{create}\L{\LB{}}
\L{\LB{\C{}//Speichern\CE{}}}
\index{TMathExpressionNode.writeToStream}\Proc{writeToStream}\L{\LB{\K{function}_\V{TMathExpressionNode.writeToStream}(\V{stream}:_\V{TStream}):_\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{result}:=\N{1};}}
\L{\LB{}\Tab{2}{\V{stream.WriteByte}(\V{byte}(\V{typ}));}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{mfbinaryAdd}_\K{then}_\K{begin}_\C{}//Teilausdrücke_falls_vorhanden_auch_speichern\CE{}}}
\L{\LB{}\Tab{4}{\V{Result}+=\V{a.writeToStream}(\V{stream});}}
\L{\LB{}\Tab{4}{\V{Result}+=\V{b.writeToStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{create}\L{\LB{\K{end};}}
\ProcCont{create}\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\C{}//Umwandlung_in_einen_String\CE{}}}
\index{TMathExpressionNode.toString}\Proc{TMathExpressionNode.toString}\L{\LB{\K{function}_\V{TMathExpressionNode.toString}(\V{outputMode}:_\V{TOutputMode};}}
\L{\LB{}\Tab{38}{\V{functionName}:_\V{string}):_\V{string};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{numberValue}\<\>\V{INT\_NAN}_\K{then}}}
\L{\LB{}\Tab{4}{\K{exit}(\V{IntToStr}(\V{numberValue}));_\C{}//konstanten_Wert_ausgeben,_falls_vorhanden\CE{}}}
\L{\LB{}\Tab{2}{\K{case}_\V{typ}_\K{of}_\C{}//Ansonsten\CE{}}}
\L{\LB{}\Tab{4}{\V{mfbase1}:}\Tab{16}{\V{result}:=\S{}{'}1{'}\SE{};}}
\L{\LB{}\Tab{4}{\V{mfbasePre1}:_\V{result}:=\V{functionName}+\S{}{'}(n\-1){'}\SE{};}}
\L{\LB{}\Tab{4}{\V{mfbasePre2}:_\V{result}:=\V{functionName}+\S{}{'}(n\-2){'}\SE{};}}
\L{\LB{}\Tab{4}{\V{mfbinaryAdd}:_\V{result}:=\S{}{'}({'}\SE{}+\V{a.toString}(\V{outputMode},\V{functionName})+\S{}{'})+({'}\SE{}+}}
\L{\LB{}\Tab{29}{\V{b.toString}(\V{outputMode},\V{functionName})+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{4}{\V{mfbinarySub}:_\V{result}:=\S{}{'}({'}\SE{}+\V{a.toString}(\V{outputMode},\V{functionName})+\S{}{'})\-({'}\SE{}+}}
\L{\LB{}\Tab{29}{\V{b.toString}(\V{outputMode},\V{functionName})+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{4}{\V{mfbinaryMul}:_\V{result}:=\S{}{'}({'}\SE{}+\V{a.toString}(\V{outputMode},\V{functionName})+\S{}{'})*({'}\SE{}+}}
\L{\LB{}\Tab{29}{\V{b.toString}(\V{outputMode},\V{functionName})+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{create}\L{\LB{\K{end};}}
\ProcCont{toString}\L{\LB{}}
\L{\LB{\C{}//Gibt_die_Kindausdrücke_frei\CE{}}}
\index{TMathExpressionNode.freeChildren}\Proc{freeChildren}\L{\LB{\K{procedure}_\V{TMathExpressionNode.freeChildren};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{a}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{a.refcount}\-=\N{1};}}
\L{\LB{}\Tab{4}{\K{if}_\V{a.refcount}\<=\N{0}_\K{then}_\K{begin};}}
\L{\LB{}\Tab{6}{\V{a.freeChildren};}}
\L{\LB{}\Tab{6}{\V{a.free};}}
\L{\LB{}\Tab{4}{\K{end};}}
\ProcCont{toString}\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{writeToStream}\L{\LB{}\Tab{2}{\K{if}_\V{b}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{b.refcount}\-=\N{1};}}
\L{\LB{}\Tab{4}{\K{if}_\V{b.refcount}\<=\N{0}_\K{then}_\K{begin};}}
\L{\LB{}\Tab{6}{\V{b.freeChildren};}}
\L{\LB{}\Tab{6}{\V{b.free};}}
\L{\LB{}\Tab{4}{\K{end};}}
\ProcCont{readFromStream}\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{calculate}\L{\LB{\K{end};}}
\ProcCont{create}\L{\LB{}}
\L{\LB{}}
\L{\LB{\C{}\{_TRecursiveExpression_\}\CE{}}}
\L{\LB{}}
\index{TRecursiveExpression.create}\Proc{TRecursiveExpression.create}\L{\LB{\K{constructor}_\V{TRecursiveExpression.create}();}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{refcount}:=\N{1};}}
\L{\LB{\K{end};}}
\ProcCont{create}\L{\LB{}}
\L{\LB{\C{}//Berechnet_die_Folge_gemäß_ihrem_rekursiven_Ausdruck\CE{}}}
\index{TRecursiveExpression.calculate}\Proc{TRecursiveExpression.calculate}\L{\LB{\K{procedure}_\V{TRecursiveExpression.calculate}(\V{len}:_\V{longint});}}
\L{\LB{\K{var}_\V{i},\V{j}:\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{move}(\V{valueStart}[\N{0}],\V{values}\5[\N{0}],\N{2}*\V{sizeof}(\V{intnumber}));_\C{}//Startwerte_übernehmen\CE{}}}
\L{\LB{}\Tab{2}{\V{realLen}:=\V{len};_\C{}//von_einer_Folge_ohne_Überlauf_ausgehen\CE{}}}
\L{\LB{}\Tab{2}{\K{for}_\V{i}:=\V{expr.initSize}_\K{to}_\V{len}\-\N{1}_\K{do}}}
\L{\LB{}\Tab{4}{\V{try}}}
\L{\LB{}\Tab{6}{\V{values}\5[\V{i}]:=\V{expr.calculate}(@\V{values}\5[\V{i}]);_\C{}//Jedes_Element_einzeln_berechnen\CE{}}}
\L{\LB{}\Tab{4}{\V{except}}}
\L{\LB{}\Tab{6}{\C{}//Überlauf\CE{}}}
\L{\LB{}\Tab{6}{\V{realLen}:=\V{i};_\C{}//Folge_abschneiden\CE{}}}
\L{\LB{}\Tab{6}{\K{if}_\V{realLen}\<\V{MIN\_SEQ\_LEN}_\K{then}_\K{exit};_\C{}//Zu_kurz_für_eine_Speicherung\CE{}}}
\L{\LB{}\Tab{6}{\K{for}_\V{j}:=\V{i}_\K{to}_\V{len}\-\N{1}_\K{do}_\C{}//Rest_auf_unbekannt_setzten,_falls_die_Folge_ok_ist\CE{}}}
\L{\LB{}\Tab{8}{\V{values}\5[\V{j}]:=\V{INT\_NAN};}}
\L{\LB{}\Tab{6}{\K{exit};}}
\L{\LB{}\Tab{4}{\K{end};}}
\ProcCont{create}\L{\LB{\K{end};}}
\ProcCont{writeToStream}\L{\LB{}}
\L{\LB{\C{}//Aus_einer_Datei_laden\CE{}}}
\index{TRecursiveExpression.readFromStream}\Proc{readFromStream}\L{\LB{\K{procedure}_\V{TRecursiveExpression.readFromStream}(\V{stream}:_\V{TStream});}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\C{}//Startwerte\CE{}}}
\L{\LB{}\Tab{2}{\V{stream.ReadBuffer}(\V{valueStart}[\N{0}],\N{2}*\V{sizeof}(\V{intnumber}));}}
\L{\LB{}\Tab{2}{\C{}//Rekursive_Definition\CE{}}}
\L{\LB{}\Tab{2}{\V{expr}:=\V{TMathExpressionNode.Create};}}
\L{\LB{}\Tab{2}{\V{expr.readFromStream}(\V{stream});}}
\L{\LB{\K{end};}}
\ProcCont{writeToStream}\L{\LB{}}
\L{\LB{\C{}//Speicher\CE{}}}
\index{TRecursiveExpression.writeToStream}\Proc{writeToStream}\L{\LB{\K{function}_\V{TRecursiveExpression.writeToStream}(\V{stream}:_\V{TStream}):_\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\C{}//Startwerte\CE{}}}
\L{\LB{}\Tab{2}{\V{stream.WriteBuffer}(\V{values}\5[\N{0}],\N{2}*\V{sizeof}(\V{intnumber}));}}
\L{\LB{}\Tab{2}{\C{}//Rekursive_Definition_(und_Bytes_zählen)\CE{}}}
\L{\LB{}\Tab{2}{\V{Result}:=\N{2}*\V{sizeof}(\V{intnumber})+\V{expr.writeToStream}(\V{stream});}}
\L{\LB{\K{end};}}
\ProcCont{writeToStream}\L{\LB{}}
\L{\LB{\C{}//In_einen_String_umwandeln\CE{}}}
\index{TRecursiveExpression.toString}\Proc{TRecursiveExpression.toString}\L{\LB{\K{function}_\V{TRecursiveExpression.toString}(\V{outputMode}:_\V{TOutputMode};}}
\L{\LB{}\Tab{36}{\V{functionName}:_\V{string}):_\V{string};}}
\L{\LB{\K{var}_\V{i}:\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{result}:=\S{}{'}{'}\SE{};}}
\L{\LB{}\Tab{2}{\K{case}_\V{outputMode}_\K{of}}}
\L{\LB{}\Tab{4}{\V{omDerive}:_\K{begin}}}
\L{\LB{}\Tab{6}{\C{}//Für_Derive_werden_die_Startwerte_in_eine_IF-Anweisung_geschrieben\CE{}}}
\L{\LB{}\Tab{6}{\V{Result}:=\V{functionName}+\S{}{'}(n):={'}\SE{};}}
\L{\LB{}\Tab{6}{\K{for}_\V{i}:=\N{0}_\K{to}_\V{expr.initSize}\-\N{1}_\K{do}}}
\L{\LB{}\Tab{8}{\V{result}+=\S{}{'}IF(n={'}\SE{}+\V{IntToStr}(\V{i})+\S{}{'},{'}\SE{}+\V{IntToStr}(\V{valueStart}[\V{i}])+\S{}{'},{'}\SE{};}}
\L{\LB{}\Tab{6}{\V{result}+=\V{expr.toString}(\V{outputMode},\V{functionName});_\C{}//Rekursive_Definition\CE{}}}
\L{\LB{}\Tab{6}{\K{for}_\V{i}:=\N{0}_\K{to}_\V{expr.initSize}\-\N{1}_\K{do}}}
\L{\LB{}\Tab{8}{\V{result}+=\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{4}{\K{end};}}
\ProcCont{writeToStream}\L{\LB{}\Tab{4}{\K{else}_\K{begin}}}
\L{\LB{}\Tab{6}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{result}:=\S{}{'}\${'}\SE{};}}
\L{\LB{}\Tab{6}{\C{}//Startwerte_hintereinander_ausgeben\CE{}}}
\L{\LB{}\Tab{6}{\K{for}_\V{i}:=\N{0}_\K{to}_\V{expr.initSize}\-\N{1do}}}
\L{\LB{}\Tab{8}{\V{result}+=\V{functionName}+\S{}{'}({'}\SE{}+\V{IntToStr}(\V{i})+\S{}{'})_=_{'}\SE{}+\V{IntToStr}(\V{valueStart}[\V{i}])+\S{}{'};_{'}\SE{};}}
\L{\LB{}\Tab{6}{\C{}//Rekursive_Definition_ausgeben\CE{}}}
\L{\LB{}\Tab{6}{\V{result}+=\V{functionName}+\S{}{'}(n)_=_{'}\SE{}+\V{expr.toString}(\V{outputMode},\V{functionName});}}
\L{\LB{}\Tab{6}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{result}+=\S{}{'}\${'}\SE{};}}
\L{\LB{}\Tab{4}{\K{end};}}
\ProcCont{readFromStream}\L{\LB{}\Tab{2}{\K{end};;}}
\ProcCont{calculate}\L{\LB{\K{end};}}
\ProcCont{toString}\L{\LB{}}
\L{\LB{\C{}//Rekursive_Definition_löschen\CE{}}}
\index{TRecursiveExpression.freeChildren}\Proc{freeChildren}\L{\LB{\K{procedure}_\V{TRecursiveExpression.freeChildren};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{expr}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{expr.refcount}\-=\N{1};}}
\L{\LB{}\Tab{4}{\K{if}_\V{expr.refcount}\<\N{0}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{6}{\V{expr.freeChildren};}}
\L{\LB{}\Tab{6}{\V{expr.free};}}
\L{\LB{}\Tab{4}{\K{end};}}
\ProcCont{toString}\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{writeToStream}\L{\LB{\K{end};}}
\ProcCont{readFromStream}\L{\LB{}}
\L{\LB{\C{}\{_TSequenceOperator_\}\CE{}}}
\L{\LB{}}
\index{TSequenceOperator.create}\Proc{TSequenceOperator.create}\L{\LB{\K{constructor}_\V{TSequenceOperator.create};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{refcount}:=\N{1};}}
\L{\LB{}\Tab{2}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{\K{end};}}
\ProcCont{readFromStream}\L{\LB{}}
\index{TSequenceOperator.create}\Proc{TSequenceOperator.create}\L{\LB{\K{constructor}_\V{TSequenceOperator.create}(\V{\_typ}:_\V{TSeqFunction};_\V{\_a},\V{\_b}:_\V{TSequenceCreator}}}
\L{\LB{}\Tab{2}{);}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{refcount}:=\N{1};}}
\L{\LB{}\Tab{2}{\V{typ}:=\V{\_typ};}}
\L{\LB{}\Tab{2}{\V{a}:=\V{\_a};}}
\L{\LB{}\Tab{2}{\V{b}:=\V{\_b};}}
\L{\LB{}\Tab{2}{\V{update};}}
\L{\LB{\K{end};}}
\ProcCont{readFromStream}\L{\LB{}}
\L{\LB{\C{}//Überprüft,_ob_die_Folge_konstant_ist\CE{}}}
\index{TSequenceOperator.update}\Proc{TSequenceOperator.update}\L{\LB{\K{procedure}_\V{TSequenceOperator.update};}}
\L{\LB{\K{var}_\V{soa},\V{sob}:_\V{TSequenceOperator};_\C{}//a_und_b_als_TSequenceOperator\CE{}}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{2}{\V{numberOnly}:=\V{false};}}
\L{\LB{}\Tab{2}{\C{}//Umwandlung_von_a_und_b_in_TSequenceOperator_falls_möglich\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{sfunarySum}_\K{then}}}
\L{\LB{}\Tab{4}{\K{if}_(\V{a}_\V{is}_\V{TSequenceOperator})_\K{then}_\V{soa}:=\V{TSequenceOperator}(\V{a})}}
\L{\LB{}\Tab{4}{\K{else}_\K{exit};}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{sfbinaryAdd}_\K{then}}}
\L{\LB{}\Tab{4}{\K{if}_(\V{b}_\V{is}_\V{TSequenceOperator})_\K{then}_\V{sob}:=\V{TSequenceOperator}(\V{b})}}
\L{\LB{}\Tab{4}{\K{else}_\K{exit};}}
\L{\LB{}\Tab{2}{\V{try}}}
\L{\LB{}\Tab{4}{\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{6}{\C{}//Basisausdrücke_sind_immer_konstant\CE{}}}
\L{\LB{}\Tab{6}{\V{sfbase1}:_\V{numberValue}:=\N{1};}}
\L{\LB{}\Tab{6}{\V{sfbase2}:_\V{numberValue}:=\N{2};}}
\L{\LB{}\Tab{6}{\V{sfbase5}:_\V{numberValue}:=\N{5};}}
\L{\LB{}\Tab{6}{\C{}//Summe_kann_konstant_0_sein\CE{}}}
\L{\LB{}\Tab{6}{\V{sfunarySum}:}}
\L{\LB{}\Tab{8}{\K{if}_\V{soa.numberValue}=\N{0}_\K{then}_\V{numberValue}:=\N{0}}}
\L{\LB{}\Tab{8}{\K{else}_\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{6}{\C{}//Produkt_kann_konstant_0_oder_1_sein\CE{}}}
\L{\LB{}\Tab{6}{\V{sfUnaryMul}:}}
\L{\LB{}\Tab{8}{\K{if}_(\V{soa.numberValue}_=_\N{0})_\K{or}_(\V{soa.numberValue}_=_\N{1})_\K{then}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{soa.numberValue}}}
\L{\LB{}\Tab{8}{\K{else}_\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{6}{\C{}//Binäre_Operatoren_sind_konstant,_falls_beide_Kindfolgen_konstant_sind\CE{}}}
\L{\LB{}\Tab{6}{\V{sfbinaryAdd}:}}
\L{\LB{}\Tab{8}{\K{if}_(\V{soa.numberValue}\<\>\V{INT\_NAN})_\K{and}_(\V{sob.numberValue}\<\>\V{INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{soa.numberValue}_+_\V{sob.numberValue}}}
\L{\LB{}\Tab{9}{\K{else}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{6}{\V{sfbinarySub}:}}
\L{\LB{}\Tab{8}{\K{if}_(\V{soa.numberValue}\<\>\V{INT\_NAN})_\K{and}_(\V{sob.numberValue}\<\>\V{INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{soa.numberValue}_\-_\V{sob.numberValue}}}
\L{\LB{}\Tab{9}{\K{else}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{6}{\V{sfbinaryMul}:}}
\L{\LB{}\Tab{8}{\K{if}_(\V{soa.numberValue}\<\>\V{INT\_NAN})_\K{and}_(\V{sob.numberValue}\<\>\V{INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{soa.numberValue}_*_\V{sob.numberValue}}}
\L{\LB{}\Tab{9}{\K{else}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{6}{\V{sfbinaryPower}:}}
\L{\LB{}\Tab{8}{\K{if}_(\V{soa.numberValue}\<\>\V{INT\_NAN})_\K{and}_(\V{sob.numberValue}\<\>\V{INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{soa.numberValue}**\V{sob.numberValue}}}
\L{\LB{}\Tab{9}{\K{else}}}
\L{\LB{}\Tab{10}{\V{numberValue}:=\V{INT\_NAN};}}
\L{\LB{}\Tab{4}{\K{end};}}
\ProcCont{readFromStream}\L{\LB{}\Tab{2}{\V{except}}}
\L{\LB{}\Tab{4}{\V{numberValue}:=\V{INT\_NAN};_\C{}//Überlauf\CE{}}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{calculate}\L{\LB{}\Tab{2}{\V{numberOnly}:=\V{numberValue}\<\>\V{INT\_NAN};}}
\L{\LB{\K{end};}}
\ProcCont{make}\L{\LB{}}
\L{\LB{\C{}//Überprüft_zwei_Folgen_auf_Gleichheit\CE{}}}
\index{TSequenceOperator.equal}\Proc{TSequenceOperator.equal}\L{\LB{\K{function}_\V{TSequenceOperator.equal}(\V{so}:_\V{TSequenceOperator}):_\V{boolean};}}
\L{\LB{\K{var}_\V{i}:\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}=\V{so.typ}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\C{}//Gleiche_Basisausdrücke_sind_immer_gleich\CE{}}}
\L{\LB{}\Tab{4}{\K{if}_\V{typ}_\K{in}_[\V{sfbase1},\V{sfbase2},\V{sfbase5}\C{}\{,sfbaseAlternate\}\CE{}]_\K{then}_\K{exit}(\V{true});}}
\L{\LB{}\Tab{4}{\C{}//Unäre_Operatoren_sind_gleich,_wenn_Parameter_gleich_sind\CE{}}}
\L{\LB{}\Tab{4}{\K{if}_\V{typ}_\K{in}_[\V{sfUnaryMul},\V{sfunarySum}]_\K{then}}}
\L{\LB{}\Tab{6}{\K{if}_(\V{a}_\V{is}_\V{TSequenceOperator})_\K{and}_(\V{b}_\V{is}_\V{TSequenceOperator})_\K{then}}}
\L{\LB{}\Tab{8}{\K{exit}(\V{TSequenceOperator}(\V{a})\V{.equal}(\V{TSequenceOperator}(\V{so.a})));}}
\L{\LB{}\Tab{2}{\K{end};}}
\ProcCont{make}\L{\LB{}\Tab{2}{\C{}//Ungleiche_Länge_=\>_ungleiche_Folge\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{realLen}\<\>\V{so.realLen}_\K{then}_\K{exit}(\V{false});}}
\L{\LB{}\Tab{2}{\C{}//Element-Element_Vergleich\CE{}}}
\L{\LB{}\Tab{2}{\V{result}:=\V{true};}}
\L{\LB{}\Tab{2}{\K{for}_\V{i}:=\N{0}_\K{to}_\V{realLen}\-\N{1}_\K{do}}}
\L{\LB{}\Tab{4}{\K{if}_\V{so.values}\5[\V{i}]\<\>\V{values}\5[\V{i}]_\K{then}_\K{exit}(\V{false});}}
\L{\LB{\K{end};}}
\ProcCont{create}\L{\LB{}}
\L{\LB{\C{}//Berechnet_die_Werte_der_Folge\CE{}}}
\index{TSequenceOperator.calculate}\Proc{TSequenceOperator.calculate}\L{\LB{\K{procedure}_\V{TSequenceOperator.calculate}(\V{len}:\V{longint});}}
\L{\LB{\K{var}_\V{i},\V{j}:\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{values}=\K{nil}_\K{then}_\K{exit};}}
\L{\LB{}\Tab{2}{\V{realLen}:=\V{len};}}
\L{\LB{}\Tab{2}{\K{for}_\V{i}:=\N{0}_\K{to}_\V{len}\-\N{1}_\K{do}}}
\L{\LB{}\Tab{4}{\V{try}}}
\L{\LB{}\Tab{6}{\C{}//Überlauf,_wenn_einer_der_Werte_undefiniert_ist\CE{}}}
\L{\LB{}\Tab{6}{\K{if}_\V{typ}\>=\V{sfunarySum}_\K{then}_\K{if}_\V{a.values}\5[\V{i}]=\V{INT\_NAN}_\K{then}}}
\L{\LB{}\Tab{8}{\V{raise}_\V{EIntOverflow.Create}(\S{}{'}{'}\SE{});}}
\L{\LB{}\Tab{6}{\K{if}_\V{typ}\>=\V{sfbinaryAdd}_\K{then}_\K{if}_\V{b.values}\5[\V{i}]=\V{INT\_NAN}_\K{then}}}
\L{\LB{}\Tab{8}{\V{raise}_\V{EIntOverflow.Create}(\S{}{'}{'}\SE{});}}
\L{\LB{}\Tab{6}{\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{8}{\C{}//Elementarfolgen\CE{}}}
\L{\LB{}\Tab{8}{\V{sfbase1}:_\V{values}\5[\V{i}]:=\N{1};}}
\L{\LB{}\Tab{8}{\V{sfbase2}:_\V{values}\5[\V{i}]:=\N{2};}}
\L{\LB{}\Tab{8}{\V{sfbase5}:_\V{values}\5[\V{i}]:=\N{5};}}
\L{\LB{}}
\L{\LB{}\Tab{8}{\C{}//Unäre_Operatoren\CE{}}}
\L{\LB{}\Tab{8}{\V{sfunarySum}:}}
\L{\LB{}\Tab{10}{\K{if}_\V{i}=\N{0}_\K{then}_\V{values}\5[\N{0}]:=\V{a.values}\5[\N{0}]}}
\L{\LB{}\Tab{10}{\K{else}_\V{values}\5[\V{i}]:=\V{values}\5[\V{i}\-\N{1}]+\V{a.values}\5[\V{i}];}}
\L{\LB{}\Tab{8}{\V{sfUnaryMul}:}}
\L{\LB{}\Tab{10}{\K{if}_\V{i}=\N{0}_\K{then}_\V{values}\5[\N{0}]:=\V{a.values}\5[\N{0}]}}
\L{\LB{}\Tab{10}{\K{else}_\V{values}\5[\V{i}]:=\V{values}\5[\V{i}\-\N{1}]*\V{a.values}\5[\V{i}];}}
\L{\LB{}}
\L{\LB{}\Tab{8}{\C{}//Binäre_Operatoren\CE{}}}
\L{\LB{}\Tab{8}{\V{sfbinaryAdd}:_\V{values}\5[\V{i}]:=\V{a.values}\5[\V{i}]+\V{b.values}\5[\V{i}];}}
\L{\LB{}\Tab{8}{\V{sfbinarySub}:_\V{values}\5[\V{i}]:=\V{a.values}\5[\V{i}]\-\V{b.values}\5[\V{i}];}}
\L{\LB{}\Tab{8}{\V{sfbinaryMul}:_\V{values}\5[\V{i}]:=\V{a.values}\5[\V{i}]*\V{b.values}\5[\V{i}];}}
\L{\LB{}\Tab{8}{\V{sfbinaryPower}:_\K{begin}}}
\L{\LB{}\Tab{10}{\V{values}\5[\V{i}]:=\V{a.values}\5[\V{i}]**\V{b.values}\5[\V{i}];}}
\L{\LB{}\Tab{10}{\K{if}_\V{b.values}\5[\V{i}]\<\N{0}_\K{then}_\V{raise}_\V{EMathError.create}(\S{}{'}{'}\SE{});}}
\L{\LB{}\Tab{8}{\K{end};}}
\ProcCont{create}\L{\LB{}\Tab{6}{\K{end};}}
\ProcCont{create}\L{\LB{}\Tab{4}{\V{except}}}
\L{\LB{}\Tab{6}{\V{realLen}:=\V{i};}}
\L{\LB{}\Tab{6}{\K{if}_\V{realLen}\<\V{MIN\_SEQ\_LEN}_\K{then}_\K{exit};}}
\L{\LB{}\Tab{6}{\K{for}_\V{j}:=\V{i}_\K{to}_\V{len}\-\N{1}_\K{do}}}
\L{\LB{}\Tab{8}{\V{values}\5[\V{j}]:=\V{INT\_NAN};}}
\L{\LB{}\Tab{6}{\K{break};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{}}
\L{\LB{\C{}//Aus_Datei_laden\CE{}}}
\index{TSequenceOperator.readFromStream}\Proc{readFromStream}\L{\LB{\K{procedure}_\V{TSequenceOperator.readFromStream}(\V{stream}:_\V{TStream});}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{typ}:=\V{TSeqFunction}(_\V{stream.ReadByte});}}
\L{\LB{}\Tab{2}{\C{}//Unterschiedlich_Kindfolgen_je_nach_Typ\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{sfunarySum}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\K{case}_\V{stream.ReadByte}_\K{of}}}
\L{\LB{}\Tab{6}{\V{REC\_CREATION\_ID}:_\V{a}:=\V{TRecursiveExpression.Create};}}
\L{\LB{}\Tab{6}{\V{SEQ\_CREATION\_ID}:_\V{a}:=\V{TSequenceOperator.Create};}}
\L{\LB{}\Tab{6}{\K{else}_\V{raise}_\V{Exception.Create}(\S{}{'}Unbekannter_Typ{'}\SE{});}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\V{a.readFromStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{sfbinaryAdd}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\K{case}_\V{stream.ReadByte}_\K{of}}}
\L{\LB{}\Tab{6}{\V{REC\_CREATION\_ID}:_\V{b}:=\V{TRecursiveExpression.Create};}}
\L{\LB{}\Tab{6}{\V{SEQ\_CREATION\_ID}:_\V{b}:=\V{TSequenceOperator.Create};}}
\L{\LB{}\Tab{6}{\K{else}_\V{raise}_\V{Exception.Create}(\S{}{'}Unbekannter_Typ{'}\SE{});}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\V{b.readFromStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\V{update};}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//Speichern\CE{}}}
\index{TSequenceOperator.writeToStream}\Proc{writeToStream}\L{\LB{\K{function}_\V{TSequenceOperator.writeToStream}(\V{stream}:_\V{TStream}):_\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{result}:=\N{1};}}
\L{\LB{}\Tab{2}{\V{stream.WriteByte}(\V{byte}(\V{typ}));}}
\L{\LB{}\Tab{2}{\C{}//Kindfolgen_mitsamt_Typ_speichern\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{sfunarySum}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\K{if}_\V{a}_\V{is}_\V{TSequenceOperator}_\K{then}_\V{stream.WriteByte}(\V{SEQ\_CREATION\_ID})}}
\L{\LB{}\Tab{4}{\K{else}_\K{if}_\V{a}_\V{is}_\V{TRecursiveExpression}_\K{then}_\V{stream.WriteByte}(\V{REC\_CREATION\_ID})}}
\L{\LB{}\Tab{4}{\K{else}_\V{raise}_\V{Exception.Create}(\S{}{'}Unbekannter_Typ{'}\SE{});}}
\L{\LB{}\Tab{4}{\V{result}+=\V{a.writeToStream}(\V{stream})+\N{1};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\K{if}_\V{typ}\>=\V{sfbinaryAdd}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\K{if}_\V{b}_\V{is}_\V{TSequenceOperator}_\K{then}_\V{stream.WriteByte}(\V{SEQ\_CREATION\_ID})}}
\L{\LB{}\Tab{4}{\K{else}_\K{if}_\V{b}_\V{is}_\V{TRecursiveExpression}_\K{then}_\V{stream.WriteByte}(\V{REC\_CREATION\_ID})}}
\L{\LB{}\Tab{4}{\K{else}_\V{raise}_\V{Exception.Create}(\S{}{'}Unbekannter_Typ{'}\SE{});}}
\L{\LB{}\Tab{4}{\V{result}+=\V{b.writeToStream}(\V{stream})+\N{1};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//In_einen_String_umwandeln\CE{}}}
\L{\LB{\C{}//variable_ist_der_Index_der_abhängigen_Variable,_functionCount_gibt_die_Zahl\CE{}}}
\L{\LB{\C{}//der_benötigten_Rekursionsfolgen_zurück_und_functions_enthält_diese_Folgen\CE{}}}
\L{\LB{\C{}//als_Strings\CE{}}}
\index{TSequenceOperator.toString}\Proc{TSequenceOperator.toString}\L{\LB{\K{function}_\V{TSequenceOperator.toString}(\V{outputMode}:_\V{TOutputMode};_\V{variable}:_\V{longint};}}
\L{\LB{}\Tab{35}{\K{var}_\V{functions}:_\V{string};}}
\L{\LB{}\Tab{35}{\K{var}_\V{functionCount}:_\V{longint}):_\V{string};}}
\L{\LB{}}
\L{\LB{}\Tab{2}{\C{}//Wandelt_eine_rekursive_Folge_in_einen_String_um_und_hängt_sie_an_functions\CE{}}}
\index{addRecursiveSequence}\Proc{addRecursiveSequence}\L{\LB{}\Tab{2}{\K{function}_\V{addRecursiveSequence}(\V{rec}:_\V{TRecursiveExpression}):\V{string};}}
\L{\LB{}\Tab{2}{\K{begin}}}
\L{\LB{}\Tab{4}{\V{inc}(\V{functionCount});}}
\L{\LB{}\Tab{4}{\K{if}_\V{functions}\<\>\S{}{'}{'}\SE{}_\K{then}_\V{functions}+=\V{LineEnding};}}
\L{\LB{}\Tab{4}{\K{case}_\V{outputMode}_\K{of}}}
\L{\LB{}\Tab{6}{\V{omLatex}:_\K{begin}}}
\L{\LB{}\Tab{8}{\V{Result}:=\S{}{'}g\_\{{'}\SE{}+\V{inttostr}(\V{functionCount})+\S{}{'}\}{'}\SE{};_\C{}//Tiefstellen_des_Index\CE{}}}
\L{\LB{}\Tab{8}{\V{functions}+=\S{}{'}\2hspace*\{20mm\}{'}\SE{};}\Tab{51}{\C{}//Einrücken\CE{}}}
\L{\LB{}\Tab{6}{\K{end};}}
\ProcCont{TSequenceOperator.toString}\L{\LB{}\Tab{6}{\K{else}_\K{begin}}}
\L{\LB{}\Tab{8}{\V{Result}:=\S{}{'}g{'}\SE{}+\V{inttostr}(\V{functionCount});}}
\L{\LB{}\Tab{8}{\V{functions}+=\S{}{'}}\Tab{22}{{'}\SE{};_\C{}//Einrücken\CE{}}}
\L{\LB{}\Tab{6}{\K{end};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\V{functions}+=\V{rec.toString}(\V{outputMode},\V{Result});}}
\L{\LB{}\Tab{4}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{functions}+=\S{}{'}\2newline{'}\SE{};}}
\L{\LB{}\Tab{4}{\V{Result}+=\S{}{'}({'}\SE{}+\V{VARIABLE\_NAMES}[\V{variable}]+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{\K{var}_\V{strA},\V{strB}:_\V{string};_\C{}//a_und_b_als_String\CE{}}}
\L{\LB{}\Tab{4}{\V{soa},\V{sob}:_\V{TSequenceOperator};_\C{}//a_und_b_als_TSequenceOperator_(falls_möglich)\CE{}}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\C{}//Konstanter_Wert_bei_konstanter_Folge\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{numberValue}\<\>\V{INT\_NAN}_\K{then}_\K{exit}(\V{IntToStr}(\V{numberValue}));}}
\L{\LB{}\Tab{2}{\C{}//Abhängige_Variable_unbekannt\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{variable}\>\V{length}(\V{VARIABLE\_NAMES})_\K{then}_\K{exit}(\S{}{'}?{'}\SE{});}}
\L{\LB{}\Tab{2}{\C{}//Summe_von_1_bis_zur_Variablen_ergibt_die_Variable_selbst\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_(\V{typ}=\V{sfunarySum})_\K{and}_(\V{a}_\V{is}_\V{TSequenceOperator})_\K{and}}}
\L{\LB{}\Tab{5}{(\V{TSequenceOperator}(\V{a})\V{.typ}=\V{sfbase1})_\K{then}}}
\L{\LB{}\Tab{5}{\K{exit}(\V{VARIABLE\_NAMES}[\V{variable}]);}}
\L{\LB{}\Tab{2}{\C{}//Summe_von_konstanter_Folge_bis_zur_Variablen_ergibt_ihr_Vielfaches\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_(\V{typ}=\V{sfunarySum})_\K{and}_(\V{a}_\V{is}_\V{TSequenceOperator})_\K{and}}}
\L{\LB{}\Tab{5}{(\V{TSequenceOperator}(\V{a})\V{.numberValue}\<\>\V{INT\_NAN})_\K{then}}}
\L{\LB{}\Tab{7}{\K{exit}(\S{}{'}({'}\SE{}+\V{IntToStr}(\V{TSequenceOperator}(\V{a})\V{.numberValue})+\S{}{'}*{'}\SE{}+}}
\L{\LB{}\Tab{16}{\V{VARIABLE\_NAMES}[\V{variable}]+\S{}{'}){'}\SE{});}}
\L{\LB{}\Tab{2}{\C{}//Umwandeln_von_a_und_b_in_strings_und_TSequenceOperators\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{a}_\V{is}_\V{TRecursiveExpression}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{strA}:=\V{addRecursiveSequence}(\V{TRecursiveExpression}(\V{a}));}}
\L{\LB{}\Tab{4}{\V{soa}:=\K{nil};}}
\L{\LB{}\Tab{2}{\K{end}_\K{else}_\V{soa}:=\V{TSequenceOperator}(\V{a});}}
\L{\LB{}\Tab{2}{\K{if}_\V{b}_\V{is}_\V{TRecursiveExpression}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{strB}:=\V{addRecursiveSequence}(\V{TRecursiveExpression}(\V{b}));}}
\L{\LB{}\Tab{4}{\V{sob}:=\K{nil};}}
\L{\LB{}\Tab{2}{\K{end}_\K{else}_\V{sob}:=\V{TSequenceOperator}(\V{b});}}
\L{\LB{}\Tab{2}{\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{4}{\V{sfunarySum},\V{sfUnaryMul}:}}
\L{\LB{}\Tab{6}{\K{if}_\V{soa}\<\>\K{nil}_\K{then}}}
\L{\LB{}\Tab{8}{\V{strA}:=\V{soa.toString}(\V{outputMode},\V{variable}+\N{1},\V{functions},\V{functionCount});}}
\L{\LB{}\Tab{4}{\V{sfbinaryAdd.\,.sfbinaryPower}:_\K{begin}}}
\L{\LB{}\Tab{6}{\K{if}_\V{soa}\<\>\K{nil}_\K{then}}}
\L{\LB{}\Tab{8}{\V{strA}:=\V{soa.toString}(\V{outputMode},\V{variable},\V{functions},\V{functionCount});}}
\L{\LB{}\Tab{6}{\K{if}_\V{sob}\<\>\K{nil}_\K{then}}}
\L{\LB{}\Tab{8}{\V{strB}:=\V{sob.toString}(\V{outputMode},\V{variable},\V{functions},\V{functionCount})}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\K{else}_\V{raise}_\V{Exception.Create}(\S{}{'}Unbekannter_Operator:_{'}\SE{}+\V{IntToStr}(\V{byte}(\V{typ})));}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\C{}//Umwandlung_von_Ausgabenmodus_unabhängigen_Operatoren\CE{}}}
\L{\LB{}\Tab{2}{\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{4}{\V{sfbase1}:}\Tab{17}{\K{exit}(\S{}{'}1{'}\SE{});_\C{}//Konstante_Werte_sollten_eigenltich_unnötig_sein\CE{}}}
\L{\LB{}\Tab{4}{\V{sfbase2}:}\Tab{17}{\K{exit}(\S{}{'}2{'}\SE{});_\C{}//Aber_sicher_ist_sicher\CE{}}}
\L{\LB{}\Tab{4}{\V{sfbase5}:}\Tab{17}{\K{exit}(\S{}{'}5{'}\SE{});}}
\L{\LB{}\Tab{4}{\V{sfbinaryAdd}:_\K{exit}(\S{}{'}({'}\SE{}+\V{strA}+\S{}{'}+{'}\SE{}+\V{strB}+\S{}{'}){'}\SE{});}}
\L{\LB{}\Tab{4}{\V{sfbinarySub}:_\K{exit}(\S{}{'}({'}\SE{}+\V{strA}+\S{}{'}\-{'}\SE{}+\V{strB}+\S{}{'}){'}\SE{});}}
\L{\LB{}\Tab{4}{\V{sfbinaryMul}:_\K{exit}(\S{}{'}({'}\SE{}+\V{strA}+\S{}{'}*{'}\SE{}+\V{strB}+\S{}{'}){'}\SE{});}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\C{}//Umwandlung_von_Ausgabenmodus_abhängigen_Operatoren\CE{}}}
\L{\LB{}\Tab{2}{\K{case}_\V{outputMode}_\K{of}}}
\L{\LB{}\Tab{4}{\V{omNormal}:_\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{6}{\V{sfunarySum}:_\V{result}:=\S{}{'}P({'}\SE{}+\V{strA}+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{6}{\V{sfUnaryMul}:_\V{result}:=\S{}{'}M({'}\SE{}+\V{strA}+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{6}{\V{sfbinaryPower}:_\V{result}:=\S{}{'}({'}\SE{}+\V{strA}+\S{}{'}\5{'}\SE{}+\V{strB}+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\V{omDerive}:_\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{6}{\V{sfunarySum}:}}
\L{\LB{}\Tab{8}{\V{result}:=\S{}{'}sum({'}\SE{}+\V{strA}+\S{}{'},{'}\SE{}+}}
\L{\LB{}\Tab{23}{\V{VARIABLE\_NAMES}[\V{variable}+\N{1}]+\S{}{'},1,{'}\SE{}+}}
\L{\LB{}\Tab{23}{\V{VARIABLE\_NAMES}[\V{variable}]+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{6}{\V{sfUnaryMul}:}}
\L{\LB{}\Tab{8}{\V{result}:=\S{}{'}product({'}\SE{}+\V{strA}+\S{}{'},{'}\SE{}+}}
\L{\LB{}\Tab{27}{\V{VARIABLE\_NAMES}[\V{variable}+\N{1}]+\S{}{'},1,{'}\SE{}+}}
\L{\LB{}\Tab{27}{\V{VARIABLE\_NAMES}[\V{variable}]+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{6}{\V{sfbinaryPower}:_\V{result}:=\S{}{'}({'}\SE{}+\V{strA}+\S{}{'}\5{'}\SE{}+\V{strB}+\S{}{'}){'}\SE{};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\V{omLatex}:_\K{case}_\V{typ}_\K{of}}}
\L{\LB{}\Tab{6}{\V{sfunarySum}:}}
\L{\LB{}\Tab{8}{\V{result}:=\S{}{'}\2sum\2limits\_\{{'}\SE{}+}}
\L{\LB{}\Tab{30}{\V{VARIABLE\_NAMES}[\V{variable}+\N{1}]+\S{}{'}=1\}\5{'}\SE{}+}}
\L{\LB{}\Tab{30}{\V{VARIABLE\_NAMES}[\V{variable}]+\S{}{'}\2left({'}\SE{}+}}
\L{\LB{}\Tab{22}{\V{strA}+\S{}{'}\2right){'}\SE{};}}
\L{\LB{}\Tab{6}{\V{sfUnaryMul}:}}
\L{\LB{}\Tab{8}{\V{result}:=\S{}{'}\2prod\2limits\_\{{'}\SE{}+}}
\L{\LB{}\Tab{31}{\V{VARIABLE\_NAMES}[\V{variable}+\N{1}]+\S{}{'}=1\}\5{'}\SE{}+}}
\L{\LB{}\Tab{31}{\V{VARIABLE\_NAMES}[\V{variable}]+\S{}{'}\2left({'}\SE{}+}}
\L{\LB{}\Tab{31}{\V{strA}+\S{}{'}\2right){'}\SE{};}}
\L{\LB{}\Tab{6}{\V{sfbinaryPower}:_\V{result}:=\V{strA}+\S{}{'}\5\{{'}\SE{}+\V{strB}+\S{}{'}\}{'}\SE{};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//Kinder_freigeben\CE{}}}
\index{TSequenceOperator.freeChildren}\Proc{TSequenceOperator.freeChildren}\L{\LB{\K{procedure}_\V{TSequenceOperator.freeChildren};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{a}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{a.refcount}\-=\N{1};}}
\L{\LB{}\Tab{4}{\K{if}_\V{a.refcount}\<=\N{0}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{6}{\V{a.freeChildren};}}
\L{\LB{}\Tab{6}{\V{a.free};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\K{if}_\V{b}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{b.refcount}\-=\N{1};}}
\L{\LB{}\Tab{4}{\K{if}_\V{b.refcount}\<=\N{0}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{6}{\V{b.freeChildren};}}
\L{\LB{}\Tab{6}{\V{b.free};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}\{_TSequenceInfo_\}\CE{}}}
\L{\LB{}}
\L{\LB{\C{}//Ausgabe_einer_Folge_als_komma-separierte_Liste_(mit_Klammern_bei_Derive)\CE{}}}
\index{printSequence}\Proc{printSequence}\L{\LB{\K{procedure}_\V{printSequence}(\V{outputMode}:\V{ToutputMode};_\V{seq}:\V{PSequenceValueBlock};_\V{len}:\V{longint});}}
\L{\LB{\K{var}_\V{i}:\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{outputMode}=\V{omDerive}_\K{then}_\V{write}(\S{}{'}[{'}\SE{});}}
\L{\LB{}\Tab{2}{\V{write}(\V{seq}\5[\N{0}]);}}
\L{\LB{}\Tab{2}{\K{for}_\V{i}:=\N{1}_\K{to}_\V{len}\-\N{1}_\K{do}_\K{begin}}}
\L{\LB{}\Tab{4}{\K{if}_\V{seq}\5[\V{i}]=\V{INT\_NAN}_\K{then}_\K{break};}}
\L{\LB{}\Tab{4}{\V{write}(\S{}{'},_{'}\SE{},\V{seq}\5[\V{i}]);}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\K{if}_\V{outputMode}=\V{omDerive}_\K{then}_\V{write}(\S{}{'}]{'}\SE{});}}
\L{\LB{}\Tab{2}{\V{writeln}();}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//Ausgabe_einer_Folge_mit_Definition\CE{}}}
\index{TSequenceInfo.print}\Proc{TSequenceInfo.print}\L{\LB{\K{procedure}_\V{TSequenceInfo.print}(\V{outputMode}:_\V{TOutputMode});}}
\L{\LB{\K{var}_\V{fCount}:\V{longint};}\Tab{26}{\C{}//Zahl_der_benötigten_rekursiven_Funktionen\CE{}}}
\L{\LB{}\Tab{4}{\V{seq},\V{functions}:\V{string};_\C{}//Folgendefinition_und_benötigte_Funktionen\CE{}}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{printSequence}(\V{outputMode},\V{values},\V{len});_\C{}//Folge_selbst_ausgeben\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{writeln}(\S{}{'}\2newline{'}\SE{});_\C{}//Neue_Zeile\CE{}}}
\L{\LB{}\Tab{2}{\C{}//Definition_durch_Folgenoperatoren\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{sequenceOperator}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{fCount}:=\N{0};_\V{functions}:=\S{}{'}{'}\SE{};}}
\L{\LB{}\Tab{4}{\V{seq}:=\V{sequenceOperator.toString}(\V{outputMode},\N{1},\V{functions},\V{fCount});}}
\L{\LB{}\Tab{4}{\K{if}_\V{fCount}\<\>\N{0}_\K{then}_\V{writeln}(\V{functions});_\C{}//Benötigte_rekursiv_definierte_Folgen\CE{}}}
\L{\LB{}\Tab{4}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{write}(\S{}{'}Definition:_\${'}\SE{})}}
\L{\LB{}\Tab{4}{\K{else}_\V{write}(\S{}{'}Definition:_{'}\SE{});}}
\L{\LB{}\Tab{4}{\V{write}(\V{seq});}}
\L{\LB{}\Tab{4}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{writeln}(\S{}{'}\${'}\SE{})_\K{else}_\V{writeln};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\C{}//Rekursive_Definition\CE{}}}
\L{\LB{}\Tab{2}{\K{if}_\V{recursive}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\K{if}_\V{sequenceOperator}\<\>\K{nil}_\K{then}}}
\L{\LB{}\Tab{6}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{writeln}(\S{}{'}\2newline{'}\SE{})_\C{}//Neue_Zeile\CE{}}}
\L{\LB{}\Tab{6}{\K{else}_\V{writeln};}}
\L{\LB{}\Tab{4}{\V{write}(\S{}{'}Definition:_{'}\SE{},\V{recursive.toString}(\V{outputMode},\S{}{'}f{'}\SE{}));}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\V{writeln}();}}
\L{\LB{}\Tab{2}{\K{if}_\V{outputMode}=\V{omLatex}_\K{then}_\V{writeln}();_\C{}//Neuer_Absatz\CE{}}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//Folgendefinition_aus_Datei_lesen\CE{}}}
\index{TSequenceInfo.readFromStream}\Proc{TSequenceInfo.readFromStream}\L{\LB{\K{procedure}_\V{TSequenceInfo.readFromStream}(\V{stream}:_\V{TStream});}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{stream.ReadByte}=\V{REC\_CREATION\_ID}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{recursive}:=\V{TRecursiveExpression.Create};}}
\L{\LB{}\Tab{4}{\V{recursive.values}:=\V{values};}}
\L{\LB{}\Tab{4}{\V{recursive.readFromStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\K{if}_\V{stream.ReadByte}=\V{SEQ\_CREATION\_ID}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{sequenceOperator}:=\V{TSequenceOperator.Create};}}
\L{\LB{}\Tab{4}{\V{sequenceOperator.values}:=\V{values};}}
\L{\LB{}\Tab{4}{\V{sequenceOperator.readFromStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//Folgendefinitionen_in_Datei_speichern\CE{}}}
\index{TSequenceInfo.writeToStream}\Proc{TSequenceInfo.writeToStream}\L{\LB{\K{function}_\V{TSequenceInfo.writeToStream}(\V{stream}:_\V{TStream}):_\V{longint};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\V{result}:=\N{2};}}
\L{\LB{}\Tab{2}{\K{if}_\V{recursive}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{stream.WriteByte}(\V{REC\_CREATION\_ID});}}
\L{\LB{}\Tab{4}{\V{Result}+=\V{recursive.writeToStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end}_\K{else}_\V{stream.WriteByte}(\N{0});}}
\L{\LB{}\Tab{2}{\K{if}_\V{sequenceOperator}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{stream.WriteByte}(\V{SEQ\_CREATION\_ID});}}
\L{\LB{}\Tab{4}{\V{Result}+=\V{sequenceOperator.writeToStream}(\V{stream});}}
\L{\LB{}\Tab{2}{\K{end}_\K{else}_\V{stream.WriteByte}(\N{0});}}
\L{\LB{\K{end};}}
\L{\LB{}}
\L{\LB{\C{}//Folgendefinitionen_löschen,_wenn_sie_keinen_gemeinsam_genutzten_Speicherplatz\CE{}}}
\L{\LB{\C{}//enthalten_(Bei_der_Erzeugung_hängen_alle_Syntaxbäume_zusammen)\CE{}}}
\index{TSequenceInfo.destroy}\Proc{TSequenceInfo.destroy}\L{\LB{\K{destructor}_\V{TSequenceInfo.destroy};}}
\L{\LB{\K{begin}}}
\L{\LB{}\Tab{2}{\K{if}_\V{standAlone}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{4}{\V{Freemem}(\V{values});}}
\L{\LB{}\Tab{4}{\K{if}_\V{recursive}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{6}{\V{recursive.freeChildren};}}
\L{\LB{}\Tab{6}{\V{recursive.free};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{4}{\K{if}_\V{sequenceOperator}\<\>\K{nil}_\K{then}_\K{begin}}}
\L{\LB{}\Tab{6}{\V{sequenceOperator.freeChildren};}}
\L{\LB{}\Tab{6}{\V{sequenceOperator.free};}}
\L{\LB{}\Tab{4}{\K{end};}}
\L{\LB{}\Tab{2}{\K{end};}}
\L{\LB{}\Tab{2}{\K{inherited};}}
\L{\LB{\K{end};}}
\L{\LB{\K{end.}}}
\L{\LB{}}
