mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-06-03 07:29:37 +00:00
Implemented syntax for a new fragment system inside the current syntax. This adds a syntax for a fragment with ASM and sub-fragments.
This commit is contained in:
parent
f492173178
commit
8617ccf1f4
|
@ -9,6 +9,30 @@ asmFile
|
|||
: asmLines EOF
|
||||
;
|
||||
|
||||
fragmentFile
|
||||
: fragmentDecl EOF
|
||||
;
|
||||
|
||||
fragmentDecl
|
||||
: 'fragment' signature '{' fragmentPart* '}'
|
||||
;
|
||||
|
||||
fragmentPart
|
||||
: 'asm' NAME '{' fragmentAsm '}' #fragmentPartAsm
|
||||
| 'fragments' '{' fragmentDecl* '}' #fragmentSubFragments
|
||||
;
|
||||
|
||||
fragmentAsm
|
||||
: asmLines #fragmentAsmLines
|
||||
| asmParamMode asmDirectiveClobber* #fragmentAsmParam
|
||||
;
|
||||
|
||||
signature
|
||||
: typeDecl directive NAME #sigParamDecl
|
||||
| NAME #sigParamUse
|
||||
| NAME '(' signature (',' signature)* ')' #sigAggregate
|
||||
;
|
||||
|
||||
importSeq
|
||||
: importDecl*
|
||||
;
|
||||
|
@ -45,6 +69,7 @@ directive
|
|||
| 'align' '(' NUMBER ')' #directiveAlign
|
||||
| 'register' '(' NAME ')' #directiveRegister
|
||||
| 'inline' #directiveInline
|
||||
| 'zeropage' #directiveZeropage
|
||||
;
|
||||
|
||||
stmtSeq
|
||||
|
@ -75,6 +100,7 @@ forIteration
|
|||
typeDecl
|
||||
: SIMPLETYPE #typeSimple
|
||||
| 'signed' SIMPLETYPE #typeSignedSimple
|
||||
| 'unsigned' SIMPLETYPE #typeUnsignedSimple
|
||||
| typeDecl '*' #typePtr
|
||||
| typeDecl '[' (expr)? ']' #typeArray
|
||||
;
|
||||
|
@ -120,6 +146,13 @@ asmLine
|
|||
: asmLabel
|
||||
| asmInstruction
|
||||
| asmBytes
|
||||
| '{' asmExprReplacement '}'
|
||||
| asmDirectiveClobber
|
||||
;
|
||||
|
||||
asmDirectiveClobber
|
||||
: 'noclobber' '(' NAME ')' #directiveNoClobber
|
||||
| 'allowclobber' '(' NAME ')' #directiveAllowClobber
|
||||
;
|
||||
|
||||
asmLabel
|
||||
|
@ -152,11 +185,16 @@ asmExpr
|
|||
| asmExpr ( '+' | '-' ) asmExpr #asmExprBinary
|
||||
| NAME #asmExprLabel
|
||||
| ASMREL #asmExprLabelRel
|
||||
| '{' NAME '}' #asmExprReplace
|
||||
| '{' asmExprReplacement '}' #asmExprReplace
|
||||
| NUMBER #asmExprInt
|
||||
| CHAR #asmExprChar
|
||||
;
|
||||
|
||||
asmExprReplacement
|
||||
: NAME #asmExprReplacementNamed
|
||||
| 'fragment' signature ( '[' NAME ']')? #asmExprReplacementFragment
|
||||
;
|
||||
|
||||
MNEMONIC:
|
||||
'brk' | 'ora' | 'kil' | 'slo' | 'nop' | 'asl' | 'php' | 'anc' | 'bpl' | 'clc' | 'jsr' | 'and' | 'rla' | 'bit' | 'rol' | 'pla' | 'plp' | 'bmi' | 'sec' |
|
||||
'rti' | 'eor' | 'sre' | 'lsr' | 'pha' | 'alr' | 'jmp' | 'bvc' | 'cli' | 'rts' | 'adc' | 'rra' | 'bvs' | 'sei' | 'sax' | 'sty' | 'sta' | 'stx' | 'dey' |
|
||||
|
|
Loading…
Reference in New Issue
Block a user