From cb7b10d1b5139f52e812df8ba1e2f2a54bfdd74a Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 23 Sep 2006 17:28:58 +0000 Subject: [PATCH] Add soccam2.1 spec --- fco/soccam-2.1-spec.txt | 430 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 430 insertions(+) create mode 100644 fco/soccam-2.1-spec.txt diff --git a/fco/soccam-2.1-spec.txt b/fco/soccam-2.1-spec.txt new file mode 100644 index 0000000..0219003 --- /dev/null +++ b/fco/soccam-2.1-spec.txt @@ -0,0 +1,430 @@ +;; soccam2.1 syntax definition -- based on occam2.1 syntax + +;; Sample translation: +;; +;; PROC graphics.plex ([num.sprites]CHAN OF SPRITE in, [num.sprites]CHAN OF BOOL in.req, CHAN OF GRAPHICS.COMMAND out, CHAN OF BOOL req) +;; [num.sprites][max.graphic]BYTE lump: +;; [num.sprites]INT lump.len, x, y, col: +;; WHILE TRUE +;; SEQ +;; BOOL b: +;; req ? b +;; PAR i = 0 FOR num.sprites +;; SEQ +;; in.req[i] ! TRUE +;; in[i] ? lump.len[i]::lump[i] ; x[i] ; y[i] ; col[i] +;; SEQ i = 0 FOR num.sprites +;; out ! sprite ; lump.len[i]::lump[i] ; x[i] ; y[i] ; col[i] +;; out ! flip +;; : +;; +;; becomes: +;; +;; (proc graphics.plex (((array num.sprites (chan-of sprite)) in) +;; ((array num.sprites (chan-of bool)) in.req) +;; ((chan-of graphics.command) out) +;; ((chan-of bool) req)) +;; (: ((array num.sprites (array max.graphic byte)) lump) +;; (: ((array num.sprites int) lump.len x y col) +;; (while true +;; (seq +;; (: (bool b) (? req b)) +;; (par (for i 0 num.sprites) +;; (seq +;; (! (sub in.req i) true) +;; (? (sub in i) ((:: (sub lump.len i) (sub lump i)) (sub x i) (sub y i) (sub col i))))) +;; (seq (for i 0 num.sprites) +;; (! out (sprite (:: (sub lump.len i) (sub lump i)) (sub x i) (sub y i) (sub col i)))) +;; (! out flip)))))) + +;; deprecate non-specifier forms in this + := + (is ) + (is ) + (val-is ) + (val-is ) + (is ) + (is ) + (is (+)) ;; is this really only 1d? + (is (+)) + (is ) + (is ) + (is ) + (is ) + + := + + + + + + + := + (place-at ) + + := + (alt +) + (alt ) + (pri-alt +) + (pri-alt ) + + := + + + (?case +) + (?case-guarded +) + (: ) + + := + (:= ) + + := + + + := + + + := + '' + + := + + + := + (?case +) + +;; unsure about "sub" -- the subscript forms could be generalised + := + + (sub ) + (sub-from-for ) + (sub-from ) + (sub-for ) + + := + (chan-of ) + (array ) + +;; occam2.1 syntax doesn't define , which can include * escapes + + := + + + (: ) + + := + (if +) + (if ) + + := + (conv ) + (round ) + (trunc ) + + := + + + := + bool + byte + int + int16 + int32 + int64 + real32 + real64 + + (array ) + + := + ( +) + ( +) + ( +) + ( +) + +;; deprecate reshapes? + := + (data-type ) + (data-type ) + (protocol ) + (protocol ) + (protocol (+)) + (proc (*) ) + (function (+) ) + (function-is (+) ) + (retypes ) + (val-retypes ) + (retypes ) + (retypes ) + (reshapes ) + (val-reshapes ) + (reshapes ) + (reshapes ) + + := + (?after ) + + := + + + - + * + / + mod ;; was \ + rem + plus + minus + times + bitand ;; also /\ + bitor ;; also \/ + bitxor ;; was >< + and + or + = + <> ;; probably want != or something + < + > + >= + <= + after + + := + + + - + + := + + ( ) + ( ) + (mostpos ) + (mostneg ) + (size ) + + +;; This is an oddity in the syntax, since it has to allow for multi-valued results from functions. + := + (+) + (call *) ;; eww, but necessary? + value-process> + + := + + + := + ( +) + (val +) + +;; Yuck -- this bit of the syntax really doesn't work nicely for soccam. + := + (*) + + := + + (guarded ) ;; overloaded meaning of "guard" here + (guarded skip) + + := + ( ) + + := + ( ) + + := + (? +) + (?case ) + + + (? ) + + := + + (:: ) + + := + + # + + := + + + + ( ) + ( ) + ( ) + true + false + + := + (while ) + + := + - + minus + bitnot ;; also ~ + not + size + + := + + + + ;; rather than (expression) + + (call *) ;; eww, as above + (sub ) ;; nothing explicit for field names? I guess they're treated as arrays + (bytesin ) + (bytesin ) + (offsetof ) + +
:= + + ( ) ;; this is literals of named types, e.g. "foo"(FILENAME) + (+) + (sub
) + (sub-from-for
) + (sub-from
) + (sub-for
) + + := + + + := + ( *) + + := + ( *) + + := + (? ) + + := + + (sub ) + (sub-from-for ) + (sub-from ) + (sub-for ) + + := + timer + (array ) ;; nope, I don't know why you'd want an array of timers either + + := + (valof ) + (: ) + + := + + (sub ) + (sub-from-for ) + (sub-from ) + (sub-for ) + + := + (+) + + := + ( ) + (: ) +