Commit Graph

31 Commits

Author SHA1 Message Date
Alex Knauth
bbcdfaf9cf add ~typecheck and ~⊢ pattern expanders (#6)
* add ~typecheck and ~⊢ pattern expanders

So that in normal macros, syntax classes, and normal syntax-parse
expressions, you can use use the Turnstile syntax to do typechecking

* add documentation for ~typecheck and ~⊢
2017-04-17 12:41:02 -07:00
Stephen Chang
115aae8e73 completely separate type and kind api, etc; generalize type environment
Previously, "type" functions were reused a lot to manipulate kinds, and other
metadata defined via `define-syntax-category`, but this meant it was impossible
to define separate behavior for some type and kind operations, e.g., type=? and
kind=?. This commit defines a separate api for each `define-syntax-category`
declaration.

Also, every `define-syntax-category` defines a new `define-NAMEd-syntax` form,
which implicitly uses the proper parameters, e.g., `define-kinded-syntax` uses
`kindcheck?`, `current-kind-eval`, and the ':: kind key by default (whereas
before, it was using typecheck?, type-eval, etc).

This commit breaks backwards compatibility. The most likely breakage results
from using a different default key for kinds. It used to be ':, the same as
types, but now the default is '::.

This commit also generalizes the contexts used with `define-NAMEd-syntax` and
`infer`.
- all contexts now accept arbitrary key-values associated with a variable
- all contexts use let* semantics, where a binding is in scope for subsequent
  bindings; this means that one environment is sufficient in most scenarioes,
  e.g., type and term vars can be mixed (if properly ordered)
- environments allow lone identifiers, which are treated as type variables by
  default
2017-02-08 13:07:24 -05:00
Stephen Chang
6707945a29 drop racket 6.4 and 6.5 from travis; fix lens dep again 2017-01-26 15:19:30 -05:00
Stephen Chang
f7de6fda4c remove lens-unstable dep
- add racket 6.4 dep
2017-01-26 13:54:46 -05:00
Stephen Chang
9f9294dc4c reduce lens dependency to lens-common and lens-unstable 2017-01-25 14:18:13 -05:00
Stephen Chang
0084146c1c rename parse-typed-syntax to syntax-parse/typecheck; closes #50 again 2017-01-24 16:56:12 -05:00
Stephen Chang
b23ee8fc3f provide syntax-parse/typed-syntax as parse-typed-syntax
- but dont remove the old name
- closes #50
2017-01-24 14:51:03 -05:00
Stephen Chang
28fa5dd033 split def-kinded-stx from def-typed-stx; split any-type? from type?
- the former prevents using current-typecheck-relation at type/kind level
- the latter differentiates "well-formed" types (star)
  from valid types (any kind)
- move define-*ed-syntax and *-eval into define-syntax-category
- turnstile must wrap define-stx-category to define new define-*ed-syntax
- add any-*? pred and any-* stx class in def-stx-category
- fixes #44
- fixes #45
2016-10-14 14:16:49 -04:00
Stephen Chang
c9c0970307 define-typed-syntax: properly handle implicit : with subsequent ⇒-props
- fixes #33
2016-10-12 15:17:31 -04:00
Stephen Chang
691ba9c51c Turnstile forms no longer automatically provide; add type-out
- not auto-providing more closely adheres to idiomatic Racket
- this commit changes:
  - define-typed-syntax
    - removed #:export-as option
  - define-base-type
    - removed #:no-provide option
  - define-type-constructor
    - removed #:no-provide option
- type-out helps with providing defined types
- in examples, move define and define-type-alias to ext-stlc
- fix bug in reuse where renamed id not provided
2016-10-12 10:46:05 -04:00
Stephen Chang
3ec2dfa431 drop [⊢ [e-stx]] ⇐-conclusion since it causes ambiguity and is undocumented 2016-10-05 10:32:53 -04:00
Stephen Chang
80d0cec122 port rest of mlish+adhoc to turnstile 2016-10-04 13:44:22 -04:00
Stephen Chang
e8faad889b add τ= in addition to τ⊑ 2016-10-03 10:16:42 -04:00
AlexKnauth
0275d0143d use tc instead of inf and use . tc in the stx class 2016-09-30 14:07:07 -04:00
Stephen Chang
088635c33a check define-typed-stx has > 0 clauses to match stx-parse; add other paper abbrvs 2016-09-24 15:12:45 -04:00
Stephen Chang
d0c14c7e07 define-typed-syntax: support define-simple-macro-like single-clause syntax 2016-09-24 15:12:45 -04:00
Stephen Chang
bce55e8741 allow omitting "_ ≫" in conclusion 2016-09-24 15:12:45 -04:00
Stephen Chang
f545503d19 allow optionally eliding more parens
- single env
- \vdash rhs
2016-09-24 15:12:45 -04:00
AlexKnauth
3d92dbdde3 add #lang turnstile/lang; change #lang turnstile's #%module-begin 2016-08-31 18:49:25 -04:00
AlexKnauth
cddfdc0349 use flatten/depth-lens instead of stx-append*n-lens 2016-08-24 09:33:54 -04:00
AlexKnauth
eacf9d50d0 support #:do and #:fail-when syntax-parse options 2016-08-18 17:08:16 -04:00
Stephen Chang
ebecdb663c allow arbitrary number of dashes in type rules
closes #23
2016-08-18 16:49:23 -04:00
Stephen Chang
6d99f352db allow single env, implies empty tvctx 2016-08-18 15:17:26 -04:00
Stephen Chang
aa0136cf29 make prop tag optional, defaults to : 2016-08-18 14:52:50 -04:00
AlexKnauth
e673527813 add #:attributes decleration 2016-08-18 13:15:29 -04:00
AlexKnauth
e9230e0ba3 remove square brackets around syntax-parse kws 2016-08-17 17:49:37 -04:00
AlexKnauth
2ddf45f8de remove brackets around e ≫ e- 2016-07-26 11:44:17 -04:00
AlexKnauth
dac08d9b15 support multiple ellipses on ind-clauses 2016-07-26 09:27:14 -04:00
AlexKnauth
d698bce58b refactor turnstile 2016-07-26 08:46:34 -04:00
AlexKnauth
b73857d151 support multiple ellipses in the rhs of turnstile clauses 2016-07-25 10:24:42 -04:00
AlexKnauth
103086a62c rename typed-lang-builder -> turnstile 2016-06-28 13:35:51 -04:00