start tapl/ dir
This commit is contained in:
parent
d29aed64b8
commit
69c97a5512
1
tapl/stlc-tests.rkt
Normal file
1
tapl/stlc-tests.rkt
Normal file
|
@ -0,0 +1 @@
|
|||
#lang s-exp "stlc.rkt"
|
17
tapl/stlc.rkt
Normal file
17
tapl/stlc.rkt
Normal file
|
@ -0,0 +1,17 @@
|
|||
#lang racket/base
|
||||
(require
|
||||
(for-syntax racket/base syntax/parse))
|
||||
|
||||
;; Simply-Typed Lambda Calculus
|
||||
;; - one arg lambda
|
||||
;; - var
|
||||
;; - binary app
|
||||
;; - binary +
|
||||
;; - integers
|
||||
|
||||
(define-syntax (datum/tc stx)
|
||||
(syntax-parse stx
|
||||
[(_ . n:integer) (⊢ (syntax/loc stx (#%datum . n)) #'Int)]
|
||||
[(_ . x)
|
||||
#:when (type-error #:src #'x #:msg "Literal ~a has unknown type." #'x)
|
||||
(syntax/loc stx (#%datum . x))]))
|
3
tapl/typecheck.rkt
Normal file
3
tapl/typecheck.rkt
Normal file
|
@ -0,0 +1,3 @@
|
|||
#lang racket/base
|
||||
|
||||
;; general type checking utility functions
|
Loading…
Reference in New Issue
Block a user