mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-03-22 08:30:07 +00:00
Beginnings of rework on the analyzer.
This commit is contained in:
parent
e2704df129
commit
023038833c
@ -50,7 +50,7 @@ certain ways. For example, these are illegal:
|
||||
### Abstract Interpretation ###
|
||||
|
||||
SixtyPical tries to prevent the program from using data that has no meaning.
|
||||
For example, the following is illegal:
|
||||
For example, the following:
|
||||
|
||||
routine do_it {
|
||||
lda #0
|
||||
@ -58,7 +58,7 @@ For example, the following is illegal:
|
||||
sta vic_border_colour ; uh... what do we know about reg A here?
|
||||
}
|
||||
|
||||
...*unless* one of the following is true:
|
||||
...is illegal *unless* one of the following is true:
|
||||
|
||||
* the A register is declared to be a meaningful output of `update_score`
|
||||
* `update_score` was determined to not change the value of the A register
|
||||
@ -183,4 +183,4 @@ TODO
|
||||
* `jsr (vector)`
|
||||
* `jmp routine`
|
||||
* insist on EOL after each instruction. need spacesWOEOL production
|
||||
* `copy immediate word`
|
||||
* asl .a
|
||||
|
41
doc/Analyzing.markdown
Normal file
41
doc/Analyzing.markdown
Normal file
@ -0,0 +1,41 @@
|
||||
Anayzling SixtyPical Programs
|
||||
=============================
|
||||
|
||||
-> Tests for functionality "Analyze SixtyPical program"
|
||||
|
||||
-> Functionality "Analyze SixtyPical program" is implemented by
|
||||
-> shell command "bin/sixtypical analyze %(test-file)"
|
||||
|
||||
A routine cannot expect registers which a called routine does not
|
||||
preserve, to be preserved.
|
||||
|
||||
| assign byte border_colour 4000
|
||||
| reserve byte score
|
||||
| routine update_score
|
||||
| {
|
||||
| lda #8
|
||||
| sta score
|
||||
| }
|
||||
| routine main {
|
||||
| lda #4
|
||||
| jsr update_score
|
||||
| sta border_colour
|
||||
| }
|
||||
? routine does not preserve register
|
||||
|
||||
But if it does it can.
|
||||
|
||||
| assign byte border_colour 4000
|
||||
| reserve byte score
|
||||
| routine update_score
|
||||
| {
|
||||
| ldx score
|
||||
| inx
|
||||
| stx score
|
||||
| }
|
||||
| routine main {
|
||||
| lda #4
|
||||
| jsr update_score
|
||||
| sta border_colour
|
||||
| }
|
||||
= True
|
@ -84,3 +84,7 @@ checkInstr (REPEAT _ branch blk) progCtx routCtx =
|
||||
routCtx
|
||||
checkInstr NOP progCtx routCtx =
|
||||
routCtx
|
||||
|
||||
checkInstr instr _ _ = error (
|
||||
"Internal error: sixtypical doesn't know how to " ++
|
||||
"analyze '" ++ (show instr) ++ "'")
|
||||
|
5
test.sh
5
test.sh
@ -1,4 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
FILES="doc/Checking.markdown doc/Emitting.markdown doc/Instruction_Support.markdown"
|
||||
FILES="doc/Checking.markdown
|
||||
doc/Emitting.markdown
|
||||
doc/Instruction_Support.markdown
|
||||
doc/Analyzing.markdown"
|
||||
./build.sh && falderal --substring-error ${FILES}
|
||||
|
Loading…
x
Reference in New Issue
Block a user