figure out how reader works

This commit is contained in:
xenia 2020-09-05 04:19:24 -04:00
parent f7b526634a
commit ac99689463
4 changed files with 27 additions and 2 deletions

View File

@ -1,6 +1,7 @@
.PHONY: all
KSY_FORMATS_REPO="https://github.com/kaitai-io/kaitai_struct_formats"
KSY_SCHEMA_REPO="https://github.com/kaitai-io/ksy_schema"
all:
@echo meow

7
examples/hello.ksy Normal file
View File

@ -0,0 +1,7 @@
#lang kaitai
meta:
id: hello_world
seq:
- id: one
type: u1

View File

@ -2,6 +2,6 @@
(define version "0.0.1")
(define collection "kaitai")
(define deps '("base"))
(define deps '("base" "yaml"))
(define test-omit-paths '("info.rkt"))
; (define scribblings '(("kaitai.scrbl"))')

View File

@ -1,3 +1,20 @@
#lang racket/base
;; empty for now
(provide (rename-out [kaitai-module-begin #%module-begin]))
(define-syntax-rule (kaitai-module-begin EXPR ...)
(#%module-begin
(displayln `(EXPR ...))))
(module reader syntax/module-reader
#:read kaitai-read
#:read-syntax kaitai-read
#:language "."
(require yaml)
(define (kaitai-read path port)
(or (read-yaml port) eof))
(define (kaitai-read-syntax path port)
(datum->syntax #f (kaitai-read path port))))