Skip to content

Commit 387365f

Browse files
committed
fix: add missing parse rule in assembler
1 parent 8039b68 commit 387365f

9 files changed

Lines changed: 498 additions & 297 deletions

File tree

poetry.lock

Lines changed: 336 additions & 288 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/parsetab/tabs.dbm.bak

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/parsetab/tabs.dbm.dat

-1.15 MB
Binary file not shown.

src/parsetab/tabs.dbm.db

1.18 MB
Binary file not shown.

src/parsetab/tabs.dbm.dir

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/zxbasm/asmparse.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,9 @@ def p_expr_div_expr(p):
925925

926926

927927
def p_expr_lprp(p):
928-
"""pexpr : LP expr RP"""
928+
"""pexpr : LP expr RP
929+
| LP pexpr RP
930+
"""
929931
p[0] = p[2]
930932

931933

src/zxbc/terminals.lark

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
// Terminals
2+
3+
ABS: /abs/i
4+
ACS: /acs/i
5+
AND: /and/i
6+
AS: /as/i
7+
AT: /at/i
8+
ASM: /asm/i
9+
ASN: /asn/i
10+
ATN: /atn/i
11+
BAND: /band/i
12+
BEEP: /beep/i
13+
BIN: /bin/i
14+
BNOT: /bnot/i
15+
BOLD: /bold/i
16+
BOR: /bor/i
17+
BORDER: /border/i
18+
BRIGHT: /bright/i
19+
BXOR: /bxor/i
20+
BYREF: /byref/i
21+
BYVAL: /byval/i
22+
CAST: /cast/i
23+
CHR: /chr|chr\$/i
24+
CIRCLE: /circle/i
25+
CLS: /cls/i
26+
CODE: /code/i
27+
CONST: /const/i
28+
CONTINUE: /continue/i
29+
COS: /cos/i
30+
DATA: /data/i
31+
DECLARE: /declare/i
32+
DIM: /dim/i
33+
DO: /do/i
34+
DRAW: /draw/i
35+
ELSE: /else/i
36+
ELSEIF: /elseif/i
37+
END: /end/i
38+
ENDIF: /endif/i
39+
ERROR: /error/i
40+
EXIT: /exit/i
41+
EXP: /exp/i
42+
FASTCALL: /fastcall/i
43+
FLASH: /flash/i
44+
FOR: /for/i
45+
FUNCTION: /function/i
46+
GO: /go/i
47+
GOTO: /goto/i
48+
GOSUB: /gosub/i
49+
IF: /if/i
50+
IN: /in/i
51+
INK: /ink/i
52+
INKEY: /inkey|inkey\$/i
53+
INT: /int/i
54+
INVERSE: /inverse/i
55+
ITALIC: /italic/i
56+
LBOUND: /lbound/i
57+
LET: /let/i
58+
LEN: /len/i
59+
LN: /ln/i
60+
LOAD: /load/i
61+
LOOP: /loop/i
62+
MOD: /mod/i
63+
NEXT: /next/i
64+
NOT: /not/i
65+
ON: /on/i
66+
OR: /or/i
67+
OUT: /out/i
68+
OVER: /over/i
69+
PAPER: /paper/i
70+
PAUSE: /pause/i
71+
PEEK: /peek/i
72+
PI: /pi/i
73+
PLOT: /plot/i
74+
POKE: /poke/i
75+
PRINT: /print/i
76+
RANDOMIZE: /randomize/i
77+
READ: /read/i
78+
RESTORE: /restore/i
79+
RETURN: /return/i
80+
RND: /rnd/i
81+
SAVE: /save/i
82+
SGN: /sgn/i
83+
SHL: /shl|<<|shl/i
84+
SHR: /shr|>>|shr/i
85+
SIN: /sin/i
86+
SIZEOF: /sizeof/i
87+
SQR: /sqr/i
88+
STDCALL: /stdcall/i
89+
STEP: /step/i
90+
STOP: /stop/i
91+
STR: /str|str\$/i
92+
SUB: /sub/i
93+
TAB: /tab/i
94+
TAN: /tan/i
95+
THEN: /then/i
96+
TO: /to/i
97+
UBOUND: /ubound/i
98+
UNTIL: /until/i
99+
USR: /usr/i
100+
VAL: /val/i
101+
VERIFY: /verify/i
102+
WEND: /wend/i
103+
WHILE: /while/i
104+
XOR: /xor/i
105+
106+
BYTE: /byte/i
107+
UBYTE: /ubyte/i
108+
INTEGER: /integer/i
109+
UINTEGER: /uinteger/i
110+
LONG: /long/i
111+
ULONG: /ulong/i
112+
FIXED: /fixed/i
113+
FLOAT: /float/i
114+
STRING: /string/i
115+
116+
CO: ":"
117+
SC: ";"
118+
COMMA: ","
119+
PLUS: "+"
120+
MINUS: "-"
121+
MUL: "*"
122+
DIV: "/"
123+
POW: "^"
124+
LP: "("
125+
RP: ")"
126+
EQ: "="
127+
NE: "<>"
128+
LT: "<"
129+
LE: "<="
130+
GT: ">"
131+
GE: ">="
132+
RIGHTARROW: "=>"
133+
134+
_INIT: /#init/i
135+
_REQUIRE: /#require/i
136+
_PRAGMA: /#pragma/i
137+
_PUSH: /push/i
138+
_POP: /pop/i
139+
140+
ASM_BLOCK: /asm/i /.*?/ /end\s+asm/is
141+
142+
ID: /[a-zA-Z_][a-zA-Z0-9_]*[$%]?/
143+
STRING_LITERAL: /\"([^\"]|\\\")*\"/
144+
NUMBER: /([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)?/
145+
INT_LITERAL: /[0-9]+/
146+
HEX_LITERAL: /(\$|0x)[0-9a-fA-F]+/
147+
BIN_LITERAL: /(%|0b)[01]+/
148+
149+
LABEL: ID ":" | INT_LITERAL ":"
150+
151+
NEWLINE: /\r?\n/
152+
WS_INLINE: /[ \t]+/
153+
COMMENT: /('.*|REM\b.*)/i
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ld hl, (_Fuente.__DATA__ + 0) - (256)
2+
ld hl, ((_Fuente.__DATA__ + 0)) - (256)
3+
ld hl, ((_Fuente.__DATA__ + 0) - (256))
4+
5+
_Fuente.__DATA__:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
! �! �* �

0 commit comments

Comments
 (0)