git @ Cat's Eye Technologies SixtyPical / 0230388
Beginnings of rework on the analyzer. Cat's Eye Technologies 7 years ago
4 changed file(s) with 52 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
4949 ### Abstract Interpretation ###
5050
5151 SixtyPical tries to prevent the program from using data that has no meaning.
52 For example, the following is illegal:
52 For example, the following:
5353
5454 routine do_it {
5555 lda #0
5757 sta vic_border_colour ; uh... what do we know about reg A here?
5858 }
5959
60 ...*unless* one of the following is true:
60 ...is illegal *unless* one of the following is true:
6161
6262 * the A register is declared to be a meaningful output of `update_score`
6363 * `update_score` was determined to not change the value of the A register
182182 * `jsr (vector)`
183183 * `jmp routine`
184184 * insist on EOL after each instruction. need spacesWOEOL production
185 * `copy immediate word`
185 * asl .a
0 Anayzling SixtyPical Programs
1 =============================
2
3 -> Tests for functionality "Analyze SixtyPical program"
4
5 -> Functionality "Analyze SixtyPical program" is implemented by
6 -> shell command "bin/sixtypical analyze %(test-file)"
7
8 A routine cannot expect registers which a called routine does not
9 preserve, to be preserved.
10
11 | assign byte border_colour 4000
12 | reserve byte score
13 | routine update_score
14 | {
15 | lda #8
16 | sta score
17 | }
18 | routine main {
19 | lda #4
20 | jsr update_score
21 | sta border_colour
22 | }
23 ? routine does not preserve register
24
25 But if it does it can.
26
27 | assign byte border_colour 4000
28 | reserve byte score
29 | routine update_score
30 | {
31 | ldx score
32 | inx
33 | stx score
34 | }
35 | routine main {
36 | lda #4
37 | jsr update_score
38 | sta border_colour
39 | }
40 = True
8383 routCtx
8484 checkInstr NOP progCtx routCtx =
8585 routCtx
86
87 checkInstr instr _ _ = error (
88 "Internal error: sixtypical doesn't know how to " ++
89 "analyze '" ++ (show instr) ++ "'")
00 #!/bin/sh
11
2 FILES="doc/Checking.markdown doc/Emitting.markdown doc/Instruction_Support.markdown"
2 FILES="doc/Checking.markdown
3 doc/Emitting.markdown
4 doc/Instruction_Support.markdown
5 doc/Analyzing.markdown"
36 ./build.sh && falderal --substring-error ${FILES}