Polishing up

This commit is contained in:
Justin Ethier 2019-09-10 17:14:16 -04:00
parent dba849ae62
commit 1c4b7cc264

View file

@ -1,14 +1,22 @@
(import ;;;; Cyclone Scheme
(scheme base) ;;;; https://github.com/justinethier/cyclone
(scheme read) ;;;;
(scheme cyclone pretty-print) ;;;; Copyright (c) 2014-2019, Justin Ethier
(scheme cyclone util)) ;;;; All rights reserved.
;; TODO: a temporary file to develop a transform pass that validates the number of arguments passed to ;;;;
;; built-in forms, and throws an error if any issues are found. The goal is to provide friendlier validation ;;;; This file validates basic syntax of special forms.
;; for the compiler ;;;; It receives S-expressions, not AST records
;;;;
(cond-expand
(program
(import
(scheme base)
(scheme read)
(scheme cyclone pretty-print)
(scheme cyclone util))))
;; ;;
;; TODO: call this from cyclone.scm after it works, probably after "resolve macros" ;; TODO: call this from cyclone.scm after it works, probably after "resolve macros"
;; TODO: will relocate this to another place, probably a separate file in scheme/cyclone
(define (validate-syntax exp) (define (validate-syntax exp)
;; Only need to track local vars if they shadow one of our keywords ;; Only need to track local vars if they shadow one of our keywords
@ -95,8 +103,10 @@
(error "unknown expression: " exp)))) (error "unknown expression: " exp))))
(search exp '())) (search exp '()))
;(if) (cond-expand
;(if 1 2 3 4) (program
;(if)
(let ((sexp (read-all (open-input-file "validation.scm")))) ;(if 1 2 3 4)
(validate-syntax sexp))
(let ((sexp (read-all (open-input-file "validation.scm"))))
(validate-syntax sexp))))