In diesem Abschnitt wird die Eingabe für den Parser-Generator ECP (Error Correcting Parser [105]) zur Definition der Eingabesprache von JANAP gelistet.
Der Parser-Generator erwartet eine Eingabe, die den Regeln einer LALR(1) Grammatik genügt (LALR(1) steht für Analyse mit LookAhead von links nach rechts mittels Rechtsableitungen [89][9][8][2]).
Für jede Syntax-Regel kann die Nummer einer Semantik-Routine angegeben werden, die aufgerufen werden soll, wenn eine Token-Kette nach dieser Regel abgeleitet wird. Für JANAP wurden 4-stellige Nummern gewählt, die sich wie folgt aufbauen:
Der Error-Corrector benötigt für jedes Terminal-Symbol zwei Kostenwerte. Der eine Wert gibt an, wieviel es kostet, wenn ein Symbol gelöscht wird, der andere gibt den Preis des Einfügen dieses Symbols an.
Die Regeln der Grammatik werden in einer BNF-ähnlichen Form (BNF steht für Backus Naur Form, [87][19]) angegeben.
*ecp bnf checkreduce statistics vocab longline errortables *terminals -- reserved words (Statements) -- insert- delete-cost DC 10 20 -- 1, 1 DEBUG 40 20 -- 1, 2 END 10 20 -- 1, 3 ENDS 10 20 -- 1, 4 EXTERN 10 20 -- 1, 5 FUNCTION 10 20 -- 1, 7 HISTO 10 20 -- 1, 8 INITIAL 10 20 -- 1, 9 LIBRARY 10 20 -- 1,10 OPTION 40 20 -- 1,11 PARAM 30 20 -- 1,12 PLOT 10 20 -- 1,13 PRINT 10 20 -- 1,14 STEADY 10 20 -- 1,15 SUBCKT 10 20 -- 1,16 TABLE 10 20 -- 1,17 TITLE 10 20 -- 1,18 TOPOLOGY 10 20 -- 1,19 TRAN 10 20 -- 1,20 VARYING 40 20 -- 1,21 -- semi reserved Words CASES 20 20 -- 2, 1 COMMON 10 20 -- 2, 2 DECADE 10 20 -- 2, 3 ENVELOPE 10 20 -- 2, 4 INTERVAL 10 20 -- 2, 5 MAGPH 40 20 -- 2, 6 POINTS 10 20 -- 2, 7 PSTEP 10 20 -- 2, 8 SCALE 10 20 -- 2, 9 SCATTER 10 20 -- 2,10 TC1 10 20 -- 2,12 TC2 10 20 -- 2,13 -- names text 10 10 -- 3, 0 integer 10 10 -- 4, 1 unreal 30 10 -- 4, 2 signreal 30 10 -- 4, 3 signdigitname 30 10 -- 4, 4 signinteger 20 10 -- 4, 5 Cname 10 10 -- 5, 1 Gname 10 10 -- 5, 2 Iname 10 10 -- 5, 3 Lname 10 10 -- 5, 4 Mname 10 10 -- 5, 5 Rname 10 10 -- 5, 6 Sname 10 10 -- 5, 7 Uname 10 10 -- 5, 8 Vname 10 10 -- 5, 9 Xname 10 10 -- 5,10 oname 10 3 -- 5,11 digitname 10 10 -- 5,12 -- special symbols , 10 10 -- 6, 1 + 10 10 -- 6, 2 - 10 10 -- 6, 3 * 10 10 -- 6, 4 / 20 10 -- 6, 5 power 10 20 -- 6, 6 = 10 10 -- 6, 7 ( 10 10 -- 6, 8 ) 10 10 -- 6, 9 _ 10 10 -- 6,10 -- expression special flags -- Warning: routine SCAN must be changed, if number changes $E 8999 0 -- 7, 1 element-function 1 param $R 8999 0 -- 7, 2 table param $V 8999 0 -- 7, 3 function call $S 8999 0 -- 7, 4 insert subcircuits
*productions <JANAP> == <OPTION-stmt> <JANAP-body> <END-stmt> == <JANAP-body> <END-stmt> <JANAP-body> == <topology-section> <end-topology> <print-topology> ... <DC-section> <transient-section> <steady-section> == $S <topology-section> == <top-sect-stmt> == <subckt-def> == <topology-section> <top-sect-stmt> == <topology-section> <subckt-def> <end-topology> == ## 0100 <top-sect-stmt> == <DEBUG-stmt> == <TITLE-stmt> == <definition-stmt> == <INITIAL-stmt> == <LIBRARY-stmt> == <topology-def> <print-topology> == == <print-topology> <TOPOLOGY-stmt> <an body-stmt> == <definition-stmt> == <output-stmt> == <TITLE-stmt> == <DEBUG-stmt> <definition-stmt> == <FUNCTION-stmt> == <TABLE-stmt> == <PARAM-stmt> <topology-def> == <C-element> == <G-element> == <I-element> == <L-element> == <M-element> == <R-element> == <S-element> == <U-element> == <V-element> == <X-element> <subckt-def> == <SUBCKT-stmt> <subckt-body> <ENDS-stmt> <subckt-body> == == <subckt-body> <top-sect-stmt> <output-stmt> == <PRINT-stmt> == <PLOT-stmt> == <HISTO-stmt> -- Statement Part -- DC Statement <DC-section> == <DC-stmt> <DC-body> <DC-stmt> == DC ## 1010 == DC CASES = integer ## 1011 <DC-body> == == <DC-body1> == <PRINT-stmt> <DC-body2> == <TITLE-stmt> <DC-body2> == <DC-body1> <PRINT-stmt> <DC-body2> == <DC-body1> <TITLE-stmt> <DC-body2> == <VARYING-stmt> == <VARYING-stmt> <DC-bodya> == <DC-body1> <VARYING-stmt> <DC-bodya> <DC-body1> == <DEBUG-stmt> == <definition-stmt> == <DC-body1> <definition-stmt> == <DC-body1> <DEBUG-stmt> <DC-bodya> == <DC-body2> == <VARYING-stmt> <DC-body2a> ## 1012 == <DC-body2> <VARYING-stmt> <DC-body2a> ## 1012 <DC-body2a> == <DEBUG-stmt> == <definition-stmt> == <output-stmt> == <DC-body2a> <DEBUG-stmt> == <DC-body2a> <definition-stmt> == <DC-body2a> <output-stmt> <DC-body2> == <DEBUG-stmt> == <definition-stmt> == <PRINT-stmt> == <TITLE-stmt> == <DC-body2> <DEBUG-stmt> == <DC-body2> <definition-stmt> == <DC-body2> <PRINT-stmt> == <DC-body2> <TITLE-stmt>
-- DEBUG Statement <DEBUG-stmt> == DEBUG <debug-par> == <DEBUG-stmt> , <debug-par> <debug-par> == <debug-name> ## 1101 == <debug-name> = number ## 1102 <debug-name> == name ## 1103 -- END Statement <END-stmt> == END ## 1200 -- ENDS Statement <ENDS-stmt> == ENDS ## 1300 -- FUNCTION Statement <FUNCTION-stmt> == FUNCTION funcname ( <func-plist> ) ... = EXTERN ## 1500 == FUNCTION funcname ( <func-plist> ) ... = <expression> ## 1501 <func-plist> == name ## 1502 == <func-plist> , name ## 1503
-- HISTO Statement <HISTO-stmt> == HISTO <histo-range> <histo-param> ## 1600 == HISTO EXTERN <histo-range> <histo-param> ## 1601 <histo-range> == ## 1602 == INTERVAL = <expression> ## 1603 == INTERVAL = <expression> , ## 1603 == POINTS = integer ## 1604 == POINTS = integer , ## 1604 <histo-param> == text <expression> ## 2421 -- INITIAL Statement <INITIAL-stmt> == INITIAL name ( name ) = number ## 1700 -- LIBRARY Statement <LIBRARY-stmt> == LIBRARY libname ## 1800 == <LIBRARY-stmt> , libname ## 1801 -- OPTION Statement <OPTION-stmt> == OPTION <option-par> == <OPTION-stmt> , <option-par> <option-par> == <option-name> = text ## 2101 <option-name> == name ## 2102 -- PARAM Statement <PARAM-stmt> == PARAM <param-par> == <PARAM-stmt> , <param-par> <param-par> == <qual-param> = <expression> ## 2200 -- PLOT Statement <PLOT-stmt> == PLOT <plot-x-par> <plot-y-scale> <plot-list> ## 2300 <plot-x-par> == <plot-x-scale> <plot-x-range> ... <plot-x-param> ## 2301 == EXTERN <plot-x-scale> <plot-x-param> ## 2302 <plot-x-param> == text <expression> ## 2421 <plot-x-scale> == ## 2310 == SCALE ( <expression> , <expression> ) ## 2311 == SCALE ( <expression> , <expression> ) , ## 2311 <plot-x-range> == ## 2320 == INTERVAL = <expression> ## 2321 == INTERVAL = <expression> , ## 2321 == POINTS = integer ## 2322 == POINTS = integer , ## 2322 <plot-y-scale> == ## 2330 == SCALE COMMON ## 2331 == SCALE COMMON , ## 2331 == SCALE ( <expression> , <expression> ) ## 2332 == SCALE ( <expression> , <expression> ) , ## 2332 <plot-list> == <plot-y-param> ## 2341 == <plot-list> , <plot-y-param> ## 2343 <plot-y-param> == text <expression> ## 2421 == text SCATTER <expression> ## 2424 == text ENVELOPE <expression> ## 2425 -- PRINT Statement <PRINT-stmt> == PRINT text ## 2400 == PRINT EXTERN text ## 2401 == PRINT <print-list> ## 2402 == PRINT EXTERN <print-list> ## 2403 == PRINT TABLE <print-list> ## 2404 == PRINT EXTERN TABLE <print-list> ## 2405 <print-list> == <print-param> ## 2406 == <print-list> , <print-param> ## 2407 <print-param> == <expression> ## 2420 == text <expression> ## 2421 == SCATTER <expression> ## 2422 == ENVELOPE <expression> ## 2423 == text SCATTER <expression> ## 2424 == text ENVELOPE <expression> ## 2425 -- STEADY Statement <steady-section> == <STEADY-stmt> <steady-body> == <STEADY-stmt> == STEADY <expression> <steady-stmt1> ## 2601 <steady-stmt1> == <steady-stmt2> == , <expression> <steady-stmt2> ## 2602 <steady-stmt2> == == , <PSTEP-clause> ## 2603 <steady-body> == == <steady-body> <an body-stmt> -- SUBCKT Statement <SUBCKT-stmt> == <SUBCKT-fpart> <SUBCKT-spart> <SUBCKT-fpart> == SUBCKT subcktname <node-list> ## 2700 <SUBCKT-spart> == ## 2702 == , <sub-par-list> ## 2701 == = <sub-par-list> ## 2701 <sub-par-list> == <sub-par> ## 2710 == <sub-par-list> , <sub-par> ## 2711 <sub-par> == name ## 2712 == FUNCTION funcname ## 2713 == TABLE tablename ## 2714 -- TABLE Statement <TABLE-stmt> == TABLE tablename <tab-plist> = <tupel-list> ## 2800 <tab-plist> == ## 2820 == ( name ) ## 2821 == ( name , name ) ## 2822 <tupel-list> == <tupel> ## 2830 == <tupel-list> , <tupel> ## 2831 <tupel> == number ## 2841 == ( number , number ) ## 2842 == ( number , number , number ) ## 2843 == ( number , number , number , ... number , number ) ## 2845
-- TITLE Statement <TITLE-stmt> == TITLE text ## 2900 -- TOPOLOGY Statement <TOPOLOGY-stmt> == TOPOLOGY text ## 3000 == TOPOLOGY <top-qualification> text ## 3001 <top-qualification> == SUBCKT <qualification> Xname ## 4405 <qualification> == ## 4404 == <qualification> Xname _ ## 4403 -- TRAN Statement <transient-section> == <TRAN-stmt> <tran-body> ## 3100 == <tran-body> == == <tran-body> <an body-stmt> <TRAN-stmt> == TRAN <expression> , <expression> ... <tran-stmt-1> ## 3101 <tran-stmt-1> == <tran-stmt-2> == , <expression> , <expression> ... <tran-stmt-2> ## 3102 <tran-stmt-2> == == , <PSTEP-clause> ## 3103 -- VARYING Statement <VARYING-stmt> == VARYING <vary-list> ## 3200 <vary-list> == <vary-par> == <vary-list> , <vary-par> <vary-par> == <qual-param> = TABLE tablename ## 3201 == <qual-param> = <expression> , ... <expression> , <step> ## 3202 -- **** Electrical Elements ***** <C-element> == Cname <node-node=> <expression> ... <TC-clause> ## 5002 <G-element> == Gname <node-node=> <expression> ... <TC-clause> ## 5003 <I-element> == Iname <node-node=> <I-V-value> ## 5200 <I-V-value> == <expression> ## 5202 == MAGPH <expression> ## 5203 == MAGPH <expression> , <expression> ## 5204 <L-element> == Lname <node-node=> <expression> ... <TC-clause> ## 5001 <M-element> == Mname Lname , Lname = <M-coupling> ## 5100 == Mname Lname , Lname , <M-coupling> ## 5100 <M-coupling> == <expression> ## 5101 == <expression> , <expression> ## 5102 <R-element> == Rname <node-node=> <expression> ... <TC-clause> ## 5000 <S-element> == Sname <node-node=> <expression> ## 5008 <U-element> == Uname <node-node=> <U-params> ## 5300 <U-params> == name = <expression> ## 5301 == <U-params> , name = <expression> ## 5303 <V-element> == Vname <node-node=> <I-V-value> ## 5201 <X-element> == Xname subcktname <node-list> <x-par-list> ## 5400 == Xname libname msubcktname <node-list> ... <x-par-list> ## 5401 <x-par-list> == ## 5415 == = <x-par-list1> ## 5416 == , <x-par-list1> ## 5416 == = <x-par-list2> ## 5426 == , <x-par-list2> ## 5426 <x-par-list1> == <x-par-list1a> <x-param> ## 5418 == <x-param> ## 5410 == <x-par-list1> <x-par-list1a> <x-param> ## 5417 <x-par-list1a> == , ## 5419 == <x-par-list1a> , ## 5419 <x-param> == <expression> ## 5412 == FUNCTION funcname ## 5413 == TABLE tablename ## 5414 <x-par-list2> == <x-param1> ## 5420 == <x-par-list2> , <x-param1> ## 5421 <x-param1> == name = <expression> ## 5422 == name = FUNCTION funcname ## 5423 == name = TABLE tablename ## 5424
-- ************************** -- common-constructs name == Cname ## 4300 == Gname ## 4300 == Iname ## 4300 == Lname ## 4300 == Mname ## 4300 == Rname ## 4300 == Sname ## 4300 == Uname ## 4300 == Vname ## 4300 == Xname ## 4300 == oname ## 4300 unnumber == integer ## 4310 == digitname ## 4311 == unreal ## 4312 signnumber == signreal ## 4316 == signdigitname ## 4317 == signinteger ## 4318 number == unnumber ## 4315 == signnumber ## 4315 subcktname == name ## 4320 == integer ## 4320 == digitname ## 4320 msubcktname == - subcktname ## 4321 == signinteger ## 4322 == signdigitname ## 4322 libname == name ## 4330 == integer ## 4330 == digitname ## 4330 tablename == name ## 4340 funcname == name ## 4340 nodename == name ## 4200 == integer ## 4200 == digitname ## 4200 signnodename == - nodename ## 4201 == signdigitname ## 4202 == signinteger ## 4202 <node-node=> == nodename signnodename = ## 4210 == nodename signnodename , ## 4210 == ( nodename signnodename ) = ## 4211 == ( nodename signnodename ) , ## 4211 <node-list> == <node-list1> ## 4222 == ( <node-list1> ) ## 4223 <node-list1> == nodename ## 4220 == <node-list1> signnodename ## 4221 <PSTEP-clause> == PSTEP = <step> <step> == <expression> ## 4021 == POINTS integer ## 4022 == DECADE integer ## 4023 <TC-clause> == ## 4100 == <TC1-clause> ## 4102 == <TC1-clause> <TC2-clause> == <TC2-clause> ## 4101 == <TC2-clause> <TC1-clause> <TC1-clause> == , TC1 = <expression> ## 4103 <TC2-clause> == , TC2 = <expression> ## 4104 <qual-param> == name ## 4400 == <X-qual> name ## 4401 <X-qual> == Xname _ ## 4402 == <X-qual> Xname _ ## 4403 -- expression <expression> == <term> <add-term> ## 4500 == + <term> <add-term> ## 4501 == - <term> <add-term> ## 4502 == <sign-term> <add-term> ## 4500 <add-term> == == <add-term> + <term> ## 4511 == <add-term> - <term> ## 4512 == <add-term> <sign-term> ## 4513 <term> == <factor> ## 4520 == <term> * <factor> ## 4521 == <term> / <factor> ## 4522 <sign-term> == <sign-factor> ## 4520 == <sign-term> * <factor> ## 4521 == <sign-term> / <factor> ## 4522 <factor> == <value> ## 4530 == <factor> power <value> ## 4531 <sign-factor> == signnumber ## 4532 == <sign-factor> power <value> ## 4531 <value> == unnumber ## 4600 == <qual-param> ## 4601 == ( <expression> ) ## 4602 == <tab-fun-name> ( <tb-par-list> ) ## 4603 <tab-fun-name> == name ## 4610 <tb-par-list> == $E <qual-element> ## 4620 == $E <qual-node> , <qual-node> ## 4621 == $R <expression> ## 4622 == $R <expression> , <expression> ## 4623 == $V <fun-par-list> ## 4624 <fun-par-list> == <expression> ## 4625 == <fun-par-list> , <expression> ## 4626 <qual-element> == name ## 4400 == <X-qual> name ## 4401 <qual-node> == nodename ## 4400 == <X-qual> nodename ## 4401