(* Partical grammar for msp430-asm *) Line = Label | Directive | Insn ; Insn = NoEm | OneEm | Special | OneArg | TwoArg | Jump ; (* Instruction formats *) NoEm = OpNoEm ; OneEm = OpOneEm Dst ; Special = "reti" | "br" Src ; OneArg = OpOneArg Src ; TwoArg = OpTwoArg Src ','? Dst ; Jump = OpJump Expr ; (* Addressing modes *) Src = '#' (SrcSpecial | '-'? Expr) | Absolute | PostInc | Indexed | Direct ; Dst = '#' (SrcSpecial | Expr) | Absolute | Indirect | Indexed | Direct ; Direct = Reg ; Indirect = '@' Reg ; PostInc = Indirect '+'? ; Indexed = Number '(' Reg ')' ; Immediate = '#' Expr ; Absolute = '&' Expr ; SrcSpecial = 0 | 1 | '-' 1 | 0xffff | 2 | 4 | 8 ; DstSpecial = 0 | 1 ; Expr = '-'? Number ; (* Pseudo-terminals *) Reg = "pc" | "sp" | "sr" | "cg" | "r0" | "r1" | "r2" | "r3" | "r4" | "r5" | "r6" | "r7" | "r8" | "r9" | "r10" | "r11" | "r12" | "r13" | "r14" | "r15" ; Identifier = ID_START ID_CONTINUE* ; Number = '-'? DIGIT ;