-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.rkt
61 lines (47 loc) · 2.47 KB
/
main.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#lang racket/base
(require racket/contract
compiler/zo-structs
zordoz/private/zo-string
zordoz/private/zo-transition
zordoz/private/zo-find
zordoz/private/zo-shell
zordoz/private/zo-syntax
zordoz/private/zo-compile)
(provide result result? result-zo result-path from-c
(contract-out
[zo->string (->* (zo?) (#:deep? boolean?) string?)]
;; Render a zo struct as a string.
;; Optional argument #:deep? determines whether to render the struct's
;; fields, or just its name.
[zo->spec (->i ([z zo?]) () [res (z) (and/c spec/c (specof z))])]
;; Convert a zo struct to a string specification.
;; Specifications are structured strings -- they are lists with
;; the same number of fields as the struct they represent.
[zo-transition (-> zo? string? (values (or/c zo? (listof zo?)) boolean?))]
;; (zo-transition z s) retrieves the field named `s` from the
;; zo struct `z`, provided:
;; - this field `s` exists
;; - the type of `s` is a zo struct (and not an integer, list, ...)
[zo-find (->* [zo? string?] [#:limit (or/c natural-number/c #f)] (listof result?))]
;; Recursively search a zo struct for sub-structures
;; with names exactly matching the argument string.
;; Matching structs are return along with the path taken to reach them
[filename->shell (-> path-string? void?)]
;; Start a REPL session to explore a .zo bytecode file
[zo->shell (-> zo? void?)]
;; Start a REPL session to explore a zo struct
[syntax->shell (-> syntax? void?)]
;; Start a REPL session to explore a syntax object
[compiled-expression->zo (-> compiled-expression? zo?)]
;; Convert a compiled expression into a zo struct
[syntax->zo (-> syntax? zo?)]
;; Compile a syntax object to a zo struct
[syntax->decompile (-> syntax? any/c)]
;; Compile a syntax object, then decompile the result to an S-expression
[toplevel-syntax->zo (-> syntax? (listof zo?))]
;; Compile a top level syntax object into a list of zo structs
[zo->compiled-expression (-> zo? compiled-expression?)]
;; Compile a zo struct
[compile-c-module (-> (or/c path-string? path?) void?)]
;; Compile a C module so it can be required in racket
))