From 30f8a88985d54a6738b80deb93216576f78b8ab7 Mon Sep 17 00:00:00 2001 From: dvanhorn Date: Mon, 25 Nov 2024 15:50:34 +0000 Subject: [PATCH] crook --- iniquity-plus/exec-io.rkt | 14 ++++++++++++++ iniquity-plus/exec.rkt | 14 ++++++++++++++ iniquity-plus/test/compile.rkt | 7 ++++--- knock-plus/exec-io.rkt | 14 ++++++++++++++ knock-plus/exec.rkt | 14 ++++++++++++++ knock-plus/test/compile.rkt | 7 ++++--- 6 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 iniquity-plus/exec-io.rkt create mode 100644 iniquity-plus/exec.rkt create mode 100644 knock-plus/exec-io.rkt create mode 100644 knock-plus/exec.rkt diff --git a/iniquity-plus/exec-io.rkt b/iniquity-plus/exec-io.rkt new file mode 100644 index 0000000..1b112b4 --- /dev/null +++ b/iniquity-plus/exec-io.rkt @@ -0,0 +1,14 @@ +#lang racket +(require a86/interp) +(require "compile.rkt") +(require "interp-io.rkt") +(require "types.rkt") +(require "build-runtime.rkt") +(provide exec/io) +;; Prog String -> (cons Answer String) +(define (exec/io p in) + (parameterize ((current-objs (list (path->string runtime-path)))) + (match (asm-interp/io (compile p) in) + [(cons 'err o) (cons 'err o)] + [(cons b o) (cons (bits->value b) o)]))) + diff --git a/iniquity-plus/exec.rkt b/iniquity-plus/exec.rkt new file mode 100644 index 0000000..c2fa74e --- /dev/null +++ b/iniquity-plus/exec.rkt @@ -0,0 +1,14 @@ +#lang racket +(require a86/interp) +(require "compile.rkt") +(require "interp.rkt") +(require "types.rkt") +(require "build-runtime.rkt") +(provide exec) +;; Prog -> Answer +(define (exec p) + (parameterize ((current-objs (list (path->string runtime-path)))) + (match (asm-interp (compile p)) + ['err 'err] + [b (bits->value b)]))) + diff --git a/iniquity-plus/test/compile.rkt b/iniquity-plus/test/compile.rkt index 48ea7ad..bc25796 100644 --- a/iniquity-plus/test/compile.rkt +++ b/iniquity-plus/test/compile.rkt @@ -1,8 +1,9 @@ #lang racket (require "../compile.rkt") (require "../parse.rkt") -(require "../run.rkt") +(require "../exec.rkt") +(require "../exec-io.rkt") (require "test-runner.rkt") -(test (λ p (run (compile (apply parse p))))) -(test/io (λ (in . p) (run/io (compile (apply parse p)) in))) +(test (λ p (exec (apply parse p)))) +(test/io (λ (in . p) (exec/io (apply parse p) in))) diff --git a/knock-plus/exec-io.rkt b/knock-plus/exec-io.rkt new file mode 100644 index 0000000..1b112b4 --- /dev/null +++ b/knock-plus/exec-io.rkt @@ -0,0 +1,14 @@ +#lang racket +(require a86/interp) +(require "compile.rkt") +(require "interp-io.rkt") +(require "types.rkt") +(require "build-runtime.rkt") +(provide exec/io) +;; Prog String -> (cons Answer String) +(define (exec/io p in) + (parameterize ((current-objs (list (path->string runtime-path)))) + (match (asm-interp/io (compile p) in) + [(cons 'err o) (cons 'err o)] + [(cons b o) (cons (bits->value b) o)]))) + diff --git a/knock-plus/exec.rkt b/knock-plus/exec.rkt new file mode 100644 index 0000000..c2fa74e --- /dev/null +++ b/knock-plus/exec.rkt @@ -0,0 +1,14 @@ +#lang racket +(require a86/interp) +(require "compile.rkt") +(require "interp.rkt") +(require "types.rkt") +(require "build-runtime.rkt") +(provide exec) +;; Prog -> Answer +(define (exec p) + (parameterize ((current-objs (list (path->string runtime-path)))) + (match (asm-interp (compile p)) + ['err 'err] + [b (bits->value b)]))) + diff --git a/knock-plus/test/compile.rkt b/knock-plus/test/compile.rkt index 48ea7ad..bc25796 100644 --- a/knock-plus/test/compile.rkt +++ b/knock-plus/test/compile.rkt @@ -1,8 +1,9 @@ #lang racket (require "../compile.rkt") (require "../parse.rkt") -(require "../run.rkt") +(require "../exec.rkt") +(require "../exec-io.rkt") (require "test-runner.rkt") -(test (λ p (run (compile (apply parse p))))) -(test/io (λ (in . p) (run/io (compile (apply parse p)) in))) +(test (λ p (exec (apply parse p)))) +(test/io (λ (in . p) (exec/io (apply parse p) in)))