1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-25 23:49:17 +00:00

Well, that's a hack. But it works.

This commit is contained in:
Chris Pressey 2015-10-18 18:47:47 +01:00
parent a9bd8a3714
commit a933c81768
5 changed files with 17 additions and 4 deletions

View File

@ -5,6 +5,7 @@ History of SixtyPical
-------
* Added `byte table` type locations and indexed addressing (`+ x`, `+ y`).
* Integer literals may be given in hexadecimal.
0.4
---

View File

@ -33,7 +33,6 @@ TODO
For 0.5:
* hexadecimal literals.
* source code comments.
For 0.6:

View File

@ -37,6 +37,11 @@ class Scanner(object):
return
if self.scan_pattern(r'\d+', 'integer literal'):
return
if self.scan_pattern(r'\$([0-9a-fA-F]+)', 'integer literal',
token_group=2, rest_group=3):
# ecch
self.token = str(eval('0x' + self.token))
return
if self.scan_pattern(r'\"(.*?)\"', 'string literal',
token_group=2, rest_group=3):
return

View File

@ -61,7 +61,7 @@ Add honours carry.
= z: 1
| routine main {
| ld a, 255
| ld a, $ff
| st off, c
| add a, 1
| }

View File

@ -19,7 +19,15 @@ Rudimentary program.
| }
= ok
Syntax error
Hex literals.
| routine main {
| ld a, $ff
| add a, $01
| }
= ok
Syntax error.
| routine foo (
| ld a, 0
@ -27,7 +35,7 @@ Syntax error
| )
? SyntaxError
Another syntax error
Another syntax error.
| byte glee
| {