prog: lines
;
lines:
/* empty line */ { list_line(); unknown=0; dcflag=0; }
/* on every new line */
// | line { list_line(); unknown=0; dcflag=0; }
| lines '\n' { list_line(); unknown=0; dcflag=0; }
| lines line { list_line(); unknown=0; dcflag=0; }
| lines error { list_line(); unknown=0; dcflag=0; }
;
line:
defsym /* define symbol (label) */
| stmnt /* opcode */
| defcon /* build-in defines */
| skip /* comment... */
| prepro /* preprocessor command */
| END { return(0); }
// | END '\n' { return(0); }
;
does this look better? it compiles without warning, and the resulting compiled module passes all the test cases.
; do you like a comment?
PORTA equ $00 ; Port A Date Register
PACTL equ $26 ; Port A Control Register
SPCR equ $28 ; Control Register
BAUD equ $2b ; SCI Baud Rate Register
SCSR equ $2e ; SCI Status Register
SCDAT equ $2f ; SCI Date Register
HPRIO equ $3c ; Mode Register
offset equ $a0 ; start
len equ $a2 ;
org $0000 ;
getbyte brclr #$20,SCSR,x,* ;
ldaa SCDAT,x ;
staa 0,y ;
ldaa 0,y ;
iny
brclr #$c0,SCSR,x,* ; Tranceiver Ready
staa SCDAT,x ; Echo
rts
delay ldy #$ffff
delayloop dey
nop
bne delayloop
rts
end
The grammar understands the source, and the compiler is correctly able to compile it.
(yes, I know there is GNU AS, GAS/11, but it's not directly compatible with Motorola Macro Assembly/11)