1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-22 01:32:13 +00:00

Attempt to bring the grammar up to date.

This commit is contained in:
Chris Pressey 2018-02-06 11:46:11 +00:00
parent 043872584b
commit 783d8764ca

View File

@ -501,11 +501,22 @@ The sense of the test can be inverted with `not`.
Grammar
-------
Program ::= {Defn} {Routine}.
Program ::= {TypeDefn} {Defn} {Routine}.
TypeDefn::= "typedef" Type Ident<new>.
Defn ::= Type Ident<new> [Constraints] (":" Literal | "@" LitWord).
Type ::= "byte" ["table"] | "vector"
Type ::= "(" Type ")" | TypeExpr ["table" TypeSize].
TypeExpr::= "byte"
| "word"
| "buffer" TypeSize
| "pointer"
| "vector" Type
| "routine" Constraints
.
TypeSize::= "[" LitWord "]".
Constrnt::= ["inputs" LocExprs] ["outputs" LocExprs] ["trashes" LocExprs].
Routine ::= "routine" Ident<new> Constraints (Block | "@" LitWord).
Routine ::= "define" Ident<new> Type (Block | "@" LitWord).
| "routine" Ident<new> Constraints (Block | "@" LitWord)
.
LocExprs::= LocExpr {"," LocExpr}.
LocExpr ::= Register | Flag | Literal | Ident.
Register::= "a" | "x" | "y".