start on an IR for spin compilation

This commit is contained in:
Sam Caldwell 2020-05-29 15:19:09 -04:00
parent 30430c391b
commit 0999c9b75b
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
#lang racket
(require "proto.rkt")
(module+ test
(require rackunit))
;; a SpinProcess is a
;; (sproc SName [Listof SVar] [Hashof SName SValue] [Setof SpinState])
(struct sproc [name vars init states] #:transparent)
;; a SName is a Symbol that is a legal variable name in Spin
;; a SVar is a
;; (svar SName SType)
(struct svar [name ty] #:transparent)
;; a SValue is one of
;; - Int
;; - Bool
;; - SName
;; and must be a valid Spin literal
;; a SType is one of
;; - 'SInt
;; - 'SBool
;; - 'mtype
(define SInt 'SInt)
(define SBool 'SBool)
(define mtype 'mtype)
;; a SpinState is a
;; (sstate SName [Sequenceof SBranch])
(struct sstate [name branches] #:transparent)
;; a SBranch is a ........