-
Notifications
You must be signed in to change notification settings - Fork 3
/
parser.yxx
3499 lines (2848 loc) · 78 KB
/
parser.yxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* parser.yxx
Revision 26-nov-2006
*/
%{
#include "pasmoimpl.h"
#include "machine.h"
#include "parseraux.h"
namespace pasmo {
namespace impl {
namespace parser {
inline Oper getop (const Token & tok)
{
return static_cast <Oper> (tok.num () );
}
inline bool isparenexp (const Token & tok)
{
return tok.num () != 0;
}
inline void checkugly (Machine & mach, const Token & tok)
{
if (isparenexp (tok) )
mach.ugly ();
}
} /* namespace parser */
%}
%pure-parser
%parse-param {Machine & mach}
%lex-param {Machine & mach}
%defines
/*
%expect 2
*/
%token TOK_BracketOnly
%token TypeUndef
%token TypeEndLine
%token TypeComment
%token TypeNumber
%token TypeLiteral
%token TypeIdentifier
%token TypeMacroName
%token TypeMacroArg
%token TypeEndOfINCLUDE
%token TypeNoFileINCLUDE
%token TypeWhiteSpace
%token TypeMOD
%token TypeSHL
%token TypeSHR
%token TypeNOT
%token TypeEQ
%token TypeLT
%token TypeLE
%token TypeGT
%token TypeGE
%token TypeNE
%token TypeNUL
%token TypeDEFINED
%token TypeHIGH
%token TypeLOW
%token TypeShlOp "<<"
%token TypeShrOp ">>"
%token TypeLeOp "<="
%token TypeGeOp ">="
%token TypeNeOp "!="
%token TypeBoolAnd "&&"
%token TypeBoolOr "||"
%token TypeSharpSharp "##"
%token TypeADC
%token TypeADD
%token TypeAND
%token TypeBIT
%token TypeCALL
%token TypeCCF
%token TypeCP
%token TypeCPD
%token TypeCPDR
%token TypeCPI
%token TypeCPIR
%token TypeCPL
%token TypeDAA
%token TypeDEC
%token TypeDI
%token TypeDJNZ
%token TypeEI
%token TypeEX
%token TypeEXX
%token TypeHALT
%token TypeIM
%token TypeIN
%token TypeINC
%token TypeIND
%token TypeINDR
%token TypeINI
%token TypeINIR
%token TypeJP
%token TypeJR
%token TypeLD
%token TypeLDD
%token TypeLDDR
%token TypeLDI
%token TypeLDIR
%token TypeNEG
%token TypeNOP
%token TypeOR
%token TypeOTDR
%token TypeOTIR
%token TypeOUT
%token TypeOUTD
%token TypeOUTI
%token TypePOP
%token TypePUSH
%token TypeRES
%token TypeRET
%token TypeRETI
%token TypeRETN
%token TypeRL
%token TypeRLA
%token TypeRLC
%token TypeRLCA
%token TypeRLD
%token TypeRR
%token TypeRRA
%token TypeRRC
%token TypeRRCA
%token TypeRRD
%token TypeRST
%token TypeSBC
%token TypeSCF
%token TypeSET
%token TypeSLA
%token TypeSLL
%token TypeSRA
%token TypeSRL
%token TypeSUB
%token TypeXOR
%token TypeA
%token TypeAF
%token TypeAFp
%token TypeB
%token TypeBC
%token TypeD
%token TypeE
%token TypeDE
%token TypeH
%token TypeL
%token TypeHL
%token TypeSP
%token TypeIX
%token TypeIXH
%token TypeIXL
%token TypeIY
%token TypeIYH
%token TypeIYL
%token TypeI
%token TypeR
%token TypeNZ
%token TypeZ
%token TypeNC
%token TypeC
%token TypePO
%token TypePE
%token TypeP
%token TypeM
%token TypeASEG
%token TypeCOMMON
%token TypeCSEG
%token TypeDB
%token TypeDEFB
%token TypeDEFL
%token TypeDEFM
%token TypeDEFS
%token TypeDEFW
%token TypeDS
%token TypeDSEG
%token TypeDW
%token TypeELSE
%token TypeEND
%token TypeENDIF
%token TypeENDM
%token TypeENDP
%token TypeEQU
%token TypeEXITM
%token TypeEXTRN
%token TypeIF
%token TypeIF1
%token TypeIF2
%token TypeIFDEF
%token TypeIFNDEF
%token TypeINCBIN
%token TypeINCLUDE
%token TypeIRP
%token TypeIRPC
%token TypeLOCAL
%token TypeMACRO
%token TypeORG
%token TypePROC
%token TypePUBLIC
%token TypeREPT
%token Type_8080
%token Type_8086
%token Type_DEPHASE
%token Type_ERROR
%token Type_PHASE
%token Type_SHIFT
%token Type_WARNING
%token Type_Z80
%token TypeAND_8080
%token TypeOR_8080
%token TypeXOR_8080
%token TypeM_8080
%token TypePSW_8080
%token TypeSET_8080
%token TypeADC_8080
%token TypeADD_8080
%token TypeACI_8080
%token TypeADI_8080
%token TypeANA_8080
%token TypeANI_8080
%token TypeCALL_8080
%token TypeCC_8080
%token TypeCM_8080
%token TypeCMA_8080
%token TypeCMC_8080
%token TypeCMP_8080
%token TypeCNC_8080
%token TypeCNZ_8080
%token TypeCP_8080
%token TypeCPE_8080
%token TypeCPI_8080
%token TypeCPO_8080
%token TypeCZ_8080
%token TypeDAD_8080
%token TypeDCR_8080
%token TypeDCX_8080
%token TypeHLT_8080
%token TypeIN_8080
%token TypeINR_8080
%token TypeINX_8080
%token TypeJC_8080
%token TypeJM_8080
%token TypeJMP_8080
%token TypeJNC_8080
%token TypeJNZ_8080
%token TypeJP_8080
%token TypeJPE_8080
%token TypeJPO_8080
%token TypeJZ_8080
%token TypeLDA_8080
%token TypeLDAX_8080
%token TypeLHLD_8080
%token TypeLXI_8080
%token TypeMVI_8080
%token TypeMOV_8080
%token TypeORA_8080
%token TypeORI_8080
%token TypeOUT_8080
%token TypePCHL_8080
%token TypePOP_8080
%token TypePUSH_8080
%token TypeRAL_8080
%token TypeRAR_8080
%token TypeRLC_8080
%token TypeRC_8080
%token TypeRRC_8080
%token TypeRET_8080
%token TypeRM_8080
%token TypeRNC_8080
%token TypeRNZ_8080
%token TypeRP_8080
%token TypeRPE_8080
%token TypeRPO_8080
%token TypeRST_8080
%token TypeRZ_8080
%token TypeSBB_8080
%token TypeSBI_8080
%token TypeSHLD_8080
%token TypeSPHL_8080
%token TypeSTA_8080
%token TypeSTAX_8080
%token TypeSTC_8080
%token TypeSUB_8080
%token TypeSUI_8080
%token TypeXCHG_8080
%token TypeXRA_8080
%token TypeXRI_8080
%token TypeXTHL_8080
/*
Operators with defined priority
*/
%left TypeHIGH TypeLOW
%left TypeBoolOr
%left TypeBoolAnd
%left TypeOR TypeOR_8080 '|' TypeXOR TypeXOR_8080
%left TypeAND TypeAND_8080 '&'
%left TypeNOT '~' '!'
%left TypeEQ TypeNE TypeLT TypeLE TypeGT TypeGE '=' "!="
'<' '>' "<=" ">="
%left '-' '+'
%left '*' '/' TypeMOD '%' TypeSHL TypeSHR "<<" ">>"
%left NEGATE
%start pasmo_exp
%{
namespace parser {
const address value_0= address (0);
const address value_1= address (1);
#define GENVALADDR(r) \
const address val ## r= static_cast <address> (r)
GENVALADDR (TypeA);
GENVALADDR (TypeC);
GENVALADDR (TypeBC);
GENVALADDR (TypeDE);
GENVALADDR (TypeHL);
GENVALADDR (TypeM);
GENVALADDR (TypeNC);
GENVALADDR (TypeNZ);
GENVALADDR (TypeP);
GENVALADDR (TypePE);
GENVALADDR (TypePO);
GENVALADDR (TypeZ);
GENVALADDR (regA);
GENVALADDR (regB);
GENVALADDR (regC);
GENVALADDR (regD);
GENVALADDR (regE);
GENVALADDR (regH);
GENVALADDR (regL);
GENVALADDR (reg_HL_);
GENVALADDR (regAF);
GENVALADDR (regBC);
GENVALADDR (regDE);
GENVALADDR (regHL);
GENVALADDR (regSP);
GENVALADDR (flagNZ);
GENVALADDR (flagZ);
GENVALADDR (flagNC);
GENVALADDR (flagC);
GENVALADDR (flagPO);
GENVALADDR (flagPE);
GENVALADDR (flagP);
GENVALADDR (flagM);
GENVALADDR (prefixNone);
GENVALADDR (prefixIX);
GENVALADDR (prefixIY);
GENVALADDR (tiADCA);
GENVALADDR (tiADDA);
GENVALADDR (tiAND);
GENVALADDR (tiCP);
GENVALADDR (tiOR);
GENVALADDR (tiSBCA);
GENVALADDR (tiSUB);
GENVALADDR (tiXOR);
GENVALADDR (codeBIT);
GENVALADDR (codeLD_A_I);
GENVALADDR (codeLD_A_R);
GENVALADDR (codeLD_I_A);
GENVALADDR (codeLD_R_A);
GENVALADDR (codeRES);
GENVALADDR (codeRL);
GENVALADDR (codeRLC);
GENVALADDR (codeRR);
GENVALADDR (codeRRC);
GENVALADDR (codeSET);
GENVALADDR (codeSLA);
GENVALADDR (codeSLL);
GENVALADDR (codeSRA);
GENVALADDR (codeSRL);
#undef GENVALADDR
inline void addregIXH (Machine & mach)
{
mach.addcode (valregH);
mach.addcode (valprefixIX);
}
inline void addregIXL (Machine & mach)
{
mach.addcode (valregL);
mach.addcode (valprefixIX);
}
inline void addregIYH (Machine & mach)
{
mach.addcode (valregH);
mach.addcode (valprefixIY);
}
inline void addregIYL (Machine & mach)
{
mach.addcode (valregL);
mach.addcode (valprefixIY);
}
} /* namespace parser */
using namespace parser;
%}
%%
/*
Operators with several forms
*/
.mod.: TypeMOD | '%';
.shl.: TypeSHL | TypeShlOp;
.shr.: TypeSHR | TypeShrOp;
.eq.: TypeEQ | '=';
.ne.: TypeNE | TypeNeOp;
.lt.: TypeLT | '<';
.gt.: TypeGT | '>';
.le.: TypeLE | TypeLeOp;
.ge.: TypeGE | TypeGeOp;
.and.: TypeAND | TypeAND_8080 | '&';
.or.: TypeOR | TypeOR_8080 | '|';
.not.: TypeNOT | '~';
.xor.: TypeXOR | TypeXOR_8080;
pasmo_exp:
| pasmoinstruc { YYACCEPT; }
| TypeEQU { mach.errmsg ("EQU without label"); }
| TypeDEFL { mach.errmsg ("DEFL without label"); }
| error { badinstruction (mach, $1); }
;
pasmoinstruc:
instruction
| TOK_BracketOnly br_instruction
;
instruction:
instLabel
| instMACROnolabel
| instMacroName
| nolabelinstruction
;
br_instruction:
br_instLabel
| instMACROnolabel
| br_instMacroName
| br_nolabelinstruction
;
nolabelinstruction:
common_instruction
| instADC
| instADD
| instAND
| instBIT
| instCALL
| instCP
| instDEC
| instEX
| instIN
| instINC
| instJP
| instLD
| instOR
| instOUT
| instRES
| instRL
| instRLC
| instRR
| instRRC
| instSBC
| instSET
| instSLA
| instSLL
| instSRA
| instSRL
| instSUB
| instXOR
;
br_nolabelinstruction:
common_instruction
| br_instADC
| br_instADD
| br_instAND
| br_instBIT
| br_instCALL
| br_instCP
| br_instDEC
| br_instEX
| br_instIN
| br_instINC
| br_instJP
| br_instLD
| br_instOR
| br_instOUT
| br_instRES
| br_instRL
| br_instRLC
| br_instRR
| br_instRRC
| br_instSBC
| br_instSET
| br_instSLA
| br_instSLL
| br_instSRA
| br_instSRL
| br_instSUB
| br_instXOR
;
common_instruction:
TypeEndLine { mach.addcode (OpEmpty); }
| instASEG
| instCSEG
| instDSEG
| instCOMMON
| instDEFB
| instDEFS
| instDEFW
| instELSE
| instEND
| instENDIF
| instENDM
| instENDP
| instEXITM
| instEXTRN
| instIF
| instIF1
| instIF2
| instIFDEF
| instIFNDEF
| instINCBIN
| instINCLUDE
| instNoFileINCLUDE
| instEndOfINCLUDE
| instIRP
| instIRPC
| instLOCAL
| instORG
| instPROC
| instPUBLIC
| instREPT
| inst_8080
| inst_8086
| inst_DEPHASE
| inst_ERROR
| inst_PHASE
| inst_SHIFT
| inst_WARNING
| inst_Z80
| instNoArgs
| instDJNZ
| instIM
| instJR
| instPOP
| instPUSH
| instRET
| instRST
| instACI_8080
| instADC_8080
| instADD_8080
| instADI_8080
| instANA_8080
| instANI_8080
| instCALL_8080
| instCMP_8080
| instCPI_8080
| instCM_8080
| instCC_8080
| instCNC_8080
| instCNZ_8080
| instCP_8080
| instCPE_8080
| instCPO_8080
| instCZ_8080
| instDAD_8080
| instDCR_8080
| instDCX_8080
| instLHLD_8080
| instIN_8080
| instINR_8080
| instINX_8080
| instJMP_8080
| instJC_8080
| instJM_8080
| instJNC_8080
| instJNZ_8080
| instJP_8080
| instJPE_8080
| instJPO_8080
| instJZ_8080
| instLDA_8080
| instLDAX_8080
| instLXI_8080
| instMOV_8080
| instMVI_8080
| instORA_8080
| instORI_8080
| instOUT_8080
| instPOP_8080
| instPUSH_8080
| instRST_8080
| instSBB_8080
| instSBI_8080
| instSHLD_8080
| instSTA_8080
| instSTAX_8080
| instSUB_8080
| instSUI_8080
| instXRA_8080
| instXRI_8080
| instXTHL_8080
;
/**********************************************************
Label
***********************************************************/
instLabel:
TypeIdentifier
{
mach.addlabel ($1.identifier () );
mach.expectmacro ();
}
labeled
;
br_instLabel:
TypeIdentifier
{
mach.addlabel ($1.identifier () );
mach.expectmacro ();
}
br_labeled
;
labeled:
instEQU
| instDEFL
| instSET_8080
| instMACRO
| ':' { mach.expectmacro (); } label_colon
| label_nocolon
;
br_labeled:
instEQU
| instDEFL
| instSET_8080
| instMACRO
| ':' { mach.expectmacro (); } br_label_colon
| br_label_nocolon
;
label_colon:
instEQU
| instDEFL
| instSET_8080
| { mach.addcode (OpGenLabel); } label_colon_inst
;
br_label_colon:
instEQU
| instDEFL
| instSET_8080
| { mach.addcode (OpGenLabel); } br_label_colon_inst
;
label_colon_inst:
TypeMacroName { mach.addmacroname ($1); } MacroArgs
| nolabelinstruction
| error { badinstruction (mach, $1); }
;
br_label_colon_inst:
TypeMacroName { mach.addmacroname ($1); } MacroArgs
| br_nolabelinstruction
| error { badinstruction (mach, $1); }
;
label_nocolon: { mach.addcode (OpGenLabel); } afterlabel;
br_label_nocolon: { mach.addcode (OpGenLabel); } br_afterlabel;
afterlabel:
| TypeMacroName { mach.addmacroname ($1); } MacroArgs
| nolabelinstruction
| error { badinstruction (mach, $1); }
;
br_afterlabel:
TypeMacroName { mach.addmacroname ($1); } MacroArgs
| br_nolabelinstruction
| error { badinstruction (mach, $1); }
;
/**********************************************************
Macro expansion
***********************************************************/
instMacroName:
TypeMacroName
{ mach.addmacroname ($1); }
MacroNameArgs
;
br_instMacroName:
TypeMacroName
{ mach.addmacroname ($1); }
br_MacroNameArgs
;
MacroNameArgs:
':' { mach.cancelmacroname (); } nolabelinstruction
| TypeMACRO { mach.redefmacro (); } MACROargs
| MacroArgs
;
br_MacroNameArgs:
':' { mach.cancelmacroname (); } br_nolabelinstruction
| TypeMACRO { mach.redefmacro (); } MACROargs
| MacroArgs
;
MacroArgs: MacroArgList { mach.addcode (OpExpandMacro); };
MacroArgList:
TypeEndLine
| ',' { mach.addcode (OpMacroArg); } MacroArgList
| '%' { mach.nomacroargs (); } MacroArgValue
| TypeMacroArg
{
mach.addmacroitem ($1);
mach.addcode (OpMacroArg);
}
MacroAfterArg
| error
{
mach.addmacroitem ($1);
yyclearin;
}
MacroMore
;
MacroMore:
TypeEndLine { mach.addcode (OpMacroArg); }
| ',' { mach.addcode (OpMacroArg); } MacroArgList
| error
{
mach.addmacroitem (Token (TypeWhiteSpace) );
mach.addmacroitem ($1);
yyclearin;
}
MacroMore
;
MacroArgValue:
exp { mach.addcode (OpMacroValue); } MacroAfterValue
| error { mach.errmsg ("Value argument expected"); }
;
MacroAfterValue:
TypeEndLine
| requireComma { mach.macroargs (); } MacroArgList
;
MacroAfterArg:
TypeEndLine
| requireComma MacroArgList
;
/**********************************************************
Directives
***********************************************************/
/**********************************************************
ASEG directive
***********************************************************/
instASEG: TypeASEG requireEndLine { mach.addcode (OpASEG); };
/**********************************************************
CSEG directive
***********************************************************/
instCSEG: TypeCSEG requireEndLine { mach.addcode (OpCSEG); };
/**********************************************************
DSEG directive
***********************************************************/
instDSEG: TypeDSEG requireEndLine { mach.addcode (OpDSEG); };
/**********************************************************
COMMON directive
***********************************************************/
instCOMMON: TypeCOMMON { unimplemented (mach, $1); };
/**********************************************************
DEFB directive
***********************************************************/
instDEFB: .defb. defblist { mach.addcode (OpDEFBend); };
defblist:
/*
TypeLiteral TypeEndLine
{
//mach.addcode (OpDEFBliteral);
//mach.addcodeliteral ($1.literal () );
mach.addcodeliteral ($1.literal () );
mach.addcode (OpDEFBnum);
}
| TypeLiteral ','
{
//mach.addcode (OpDEFBliteral);
//mach.addcodeliteral ($1.literal () );
mach.addcodeliteral ($1.literal () );
mach.addcode (OpDEFBnum);
}
defblist
*/
exp TypeEndLine { mach.addcode (OpDEFBnum); }
| exp ',' { mach.addcode (OpDEFBnum); } defblist
| exp error { badnextarg (mach, $2); }
| error { badDEFB (mach, $1); }
;
/**********************************************************
DEFL directive
***********************************************************/
instDEFL: TypeDEFL DEFLargs;
instSET_8080: TypeSET_8080 DEFLargs;
DEFLargs:
| exp requireEndLine { mach.addcode (OpDEFL); }
| error { badDEFL (mach, $1); }
;
/**********************************************************
DEFS directive
***********************************************************/
instDEFS: .defs. DEFS_args requireEndLine;
DEFS_args:
exp DEFS_count_arg;
| error { badDEFS (mach, $1); }
;
DEFS_count_arg:
TypeEndLine { mach.addcode (OpDEFS); }
| check_next_arg DEFS_value
;
DEFS_value:
exp requireEndLine { mach.addcode (OpDEFSvalue); }
| error { badDEFS_value (mach, $1); }
;
/**********************************************************
DEFW directive
***********************************************************/
instDEFW: .defw. DEFWargs { mach.addcode (OpDEFWend); };
DEFWargs: DEFWitem DEFWmore;
DEFWmore:
TypeEndLine
| check_next_arg DEFWargs
;
DEFWitem:
exp { mach.addcode (OpDEFWnum); }
| error { badDEFW (mach, $1); }
;
/**********************************************************
ELSE directive
***********************************************************/
instELSE: TypeELSE requireEndLine { mach.addcode (OpELSE); };
/**********************************************************
END directive
***********************************************************/
instEND: TypeEND ENDargs;
ENDargs:
TypeEndLine { mach.addcode (OpEND); }
| exp requireEndLine { mach.addcode (OpENDn); }
| error { badEND (mach, $1); }
;
/**********************************************************
ENDIF directive
***********************************************************/
instENDIF: TypeENDIF requireEndLine { mach.addcode (OpENDIF); };
/**********************************************************
ENDM directive
***********************************************************/
instENDM: TypeENDM requireEndLine { mach.addcode (OpENDM); };
/**********************************************************
ENDP directive
***********************************************************/
instENDP: TypeENDP requireEndLine { mach.addcode (OpENDP); };
/**********************************************************
EQU directive
***********************************************************/
instEQU: TypeEQU EQUargs;
EQUargs:
| exp requireEndLine { mach.addcode (OpEQU); }
| error { badEQU (mach, $1); }
;
/**********************************************************
EXITM directive
***********************************************************/
instEXITM: TypeEXITM requireEndLine { mach.addcode (OpEXITM); };
/**********************************************************
EXTRN directive
***********************************************************/
instEXTRN: TypeEXTRN VarList { mach.addcode (OpEXTRN); };
/**********************************************************
IF directive
***********************************************************/
instIF: TypeIF IFarg requireEndLine;
IFarg:
exp { mach.addcode (OpIF); }
| error { badIF (mach, $1); }
;
/**********************************************************
IF1 directive
***********************************************************/