Documentation updates.
Chris Pressey
7 years ago
5 | 5 | |
6 | 6 | * Added the so-called "open-faced `for` loop", which spans a loop |
7 | 7 | variable over a range, the end of which is fixed. |
8 | * `--origin` and `--output-format` options added to reference compiler. | |
9 | 8 | * "Tail position" is now more correctly determined for the purposes of |
10 | 9 | insisting that `goto` only appears in it. |
10 | * New `--origin` and `--output-format` options added to the compiler. | |
11 | 11 | * Fixed bug when `--prelude` option was missing. |
12 | 12 | * Fixed bug when reporting line numbers of scanner-level syntax errors. |
13 | * Translated the small demo project Ribos and "The PETulant Cursor" | |
14 | to SixtyPical and added them to the `eg/c64/` section of the repo. | |
13 | * Translated the small demo projects Ribos and "The PETulant Cursor" to | |
14 | SixtyPical, and added them to the `eg/c64/` section of the repo. | |
15 | 15 | |
16 | 16 | 0.13 |
17 | 17 | ---- |
2 | 2 | |
3 | 3 | _Version 0.14. Work-in-progress, everything is subject to change._ |
4 | 4 | |
5 | **SixtyPical** is a 6502-assembly-like programming language with advanced | |
5 | **SixtyPical** is a 6502-like programming language with advanced | |
6 | 6 | static analysis. |
7 | 7 | |
8 | "6502-assembly-like" means that it has similar restrictions as programming | |
8 | "6502-like" means that it has similar restrictions as programming | |
9 | 9 | in 6502 assembly (e.g. the programmer must choose the registers that |
10 | 10 | values will be stored in) and is concomitantly easy for a compiler to |
11 | 11 | translate it to 6502 machine language code. |
14 | 14 | go through the program step by step, tracking not just the changes that |
15 | 15 | happen during a _specific_ execution of the program, but _sets_ of changes |
16 | 16 | that could _possibly_ happen in any run of the program. This lets us |
17 | determine that certain things can never happen, which we can present as | |
18 | safety guarantees. | |
17 | determine that certain things can never happen, which we can then formulate | |
18 | as safety checks. | |
19 | 19 | |
20 | 20 | In practice, this means it catches things like |
21 | 21 | |
50 | 50 |  |
51 | 51 | |
52 | 52 | You can try the `loadngo.sh` script on other sources in the `eg` directory |
53 | tree. There is an entire small game(-like program) in [demo-game.60p](eg/c64/demo-game/demo-game.60p). | |
53 | tree, which contains more extensive examples, including an entire | |
54 | game(-like program); see [eg/README.md](eg/README.md) for a listing. | |
54 | 55 | |
55 | 56 | Documentation |
56 | 57 | ------------- |
0 | 0 | SixtyPical |
1 | 1 | ========== |
2 | 2 | |
3 | This document describes the SixtyPical programming language version 0.11, | |
3 | This document describes the SixtyPical programming language version 0.14, | |
4 | 4 | both its static semantics (the capabilities and limits of the static |
5 | 5 | analyses it defines) and its runtime semantics (with reference to the |
6 | 6 | semantics of 6502 machine code.) |
233 | 233 | are considered initialized after it has executed. |
234 | 234 | |
235 | 235 | If and only if src is a byte table, the index-memory-location must be given. |
236 | In this case, it is illegal if the value of the index-memory-location falls | |
237 | outside of the range of the table. | |
236 | 238 | |
237 | 239 | Some combinations, such as `ld x, y`, are illegal because they do not map to |
238 | underlying opcodes. | |
240 | underlying opcodes. (For an instruction which maps more flexibly to underlying | |
241 | opcodes, see `copy`.) | |
239 | 242 | |
240 | 243 | There is another mode of `ld` which reads into `a` indirectly through a pointer. |
241 | 244 | |
264 | 267 | changed by this instruction (unless of course dest is a flag.) |
265 | 268 | |
266 | 269 | If and only if dest is a byte table, the index-memory-location must be given. |
270 | In this case, it is illegal if the value of the index-memory-location falls | |
271 | outside of the range of the table. | |
267 | 272 | |
268 | 273 | There is another mode of `st` which write `a` into memory, indirectly through |
269 | 274 | a pointer. |
570 | 575 | LocExpr ::= Register | Flag | Literal | Ident. |
571 | 576 | Register::= "a" | "x" | "y". |
572 | 577 | Flag ::= "c" | "z" | "n" | "v". |
573 | Literal ::= LitByte | LitWord. | |
578 | Literal ::= LitByte | LitWord | LitBit. | |
574 | 579 | LitByte ::= "0" ... "255". |
575 | 580 | LitWord ::= "0" ... "65535". |
581 | LitBit ::= "on" | "off". | |
576 | 582 | Block ::= "{" {Instr} "}". |
577 | 583 | Instr ::= "ld" LocExpr "," LocExpr ["+" LocExpr] |
578 | 584 | | "st" LocExpr "," LocExpr ["+" LocExpr] |
588 | 594 | | "dec" LocExpr |
589 | 595 | | "call" Ident<routine> |
590 | 596 | | "goto" Ident<executable> |
597 | | "copy" LocExpr "," LocExpr ["+" LocExpr] | |
591 | 598 | | "if" ["not"] LocExpr Block ["else" Block] |
592 | 599 | | "repeat" Block ("until" ["not"] LocExpr | "forever") |
593 | | "copy" LocExpr "," LocExpr ["+" LocExpr] | |
600 | | "for" LocExpr ("up"|"down") "to" Literal Block | |
601 | | "with" "interrupts" LitBit Block | |
594 | 602 | . |
0 | This directory contains SixtyPical example programs, categorized | |
1 | in subdirectories by the machine architecture. | |
2 | ||
3 | In the [c64](c64/) directory are programs that run on the Commodore 64: | |
4 | ||
5 | * [demo-game](c64/demo-game/): a little game-like program written as a | |
6 | "can we write something you'd see in practice?" test case for SixtyPical. | |
7 | * [ribos](c64/ribos/): a well-commented example of a C64 raster interrupt | |
8 | routine. Originally written with the P65 assembler (now Ophis). | |
9 | The second version of it has been translated to SixtyPical. | |
10 | * [petulant](c64/petulant/) -- "The PETulant Cursor", a tiny (44 bytes) | |
11 | "display hack". Originally written in the late 80's. Rewritten with | |
12 | the P65 assembler (now Ophis) and re-released April 1, 2008 (a | |
13 | hint as to its nature). Translated to SixtyPical, it's 48 bytes. | |
14 | ||
15 | In the [rudiments](rudiments/) directory are programs which are not for | |
16 | any particular machine, but meant to demonstrate the features of SixtyPical. | |
17 | Some are meant to fail and produce an error message. Others can run on | |
18 | any architecture where there is a routine at 65490 which outputs the value | |
19 | of the accumulator as an ASCII character. |