mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-22 01:32:13 +00:00
Support line comments.
This commit is contained in:
parent
a933c81768
commit
9235c6eacc
@ -6,6 +6,7 @@ History of SixtyPical
|
||||
|
||||
* Added `byte table` type locations and indexed addressing (`+ x`, `+ y`).
|
||||
* Integer literals may be given in hexadecimal.
|
||||
* Line comments may be included in source code by prefixing them with `//`.
|
||||
|
||||
0.4
|
||||
---
|
||||
|
@ -33,8 +33,6 @@ TODO
|
||||
|
||||
For 0.5:
|
||||
|
||||
* source code comments.
|
||||
|
||||
For 0.6:
|
||||
|
||||
* `interrupt` routines.
|
||||
|
@ -1,12 +1,16 @@
|
||||
// Displays 256 hearts at the top of the Commodore 64's screen.
|
||||
|
||||
// Define where the screen starts in memory:
|
||||
byte table screen @ 1024
|
||||
|
||||
routine main
|
||||
// These are the values that will be written to by this routine:
|
||||
trashes a, x, z, n, screen
|
||||
{
|
||||
ld x, 0
|
||||
ld a, 83
|
||||
ld a, 83 // 83 = screen code for heart
|
||||
repeat {
|
||||
st a, screen + x
|
||||
inc x
|
||||
} until z
|
||||
} until z // this flag will be set when x wraps around from 255 to 0
|
||||
}
|
||||
|
@ -29,6 +29,8 @@ class Scanner(object):
|
||||
|
||||
def scan(self):
|
||||
self.scan_pattern(r'[ \t\n\r]*', 'whitespace')
|
||||
while self.scan_pattern(r'\/\/.*?[\n\r]', 'comment'):
|
||||
self.scan_pattern(r'[ \t\n\r]*', 'whitespace')
|
||||
if not self.text:
|
||||
self.token = None
|
||||
self.type = 'EOF'
|
||||
|
@ -19,6 +19,16 @@ Rudimentary program.
|
||||
| }
|
||||
= ok
|
||||
|
||||
Program with comments.
|
||||
|
||||
| // Welcome to my program.
|
||||
|
|
||||
| routine main {
|
||||
| ld a, 0
|
||||
| add a, 1 // We are adding the thing.
|
||||
| }
|
||||
= ok
|
||||
|
||||
Hex literals.
|
||||
|
||||
| routine main {
|
||||
|
Loading…
Reference in New Issue
Block a user