From c0b26a27818ab0efe8aa4939ca34a61745879cde Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sun, 30 Oct 2011 23:05:31 -0700 Subject: [PATCH] syntax: make it so PRIMITIVE: verifies primitives It's a bit strange for disparate vocabs to reference words that get created out of thin air during bootstrap, so this lets there be some trace in the seeded vocab source that there was a word created there. --- core/syntax/syntax.factor | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 803287a89d..cd90ea0b92 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -8,7 +8,7 @@ generic.standard generic.hook generic.math generic.parser classes io.pathnames vocabs vocabs.parser classes.parser classes.union classes.intersection classes.mixin classes.predicate classes.singleton classes.tuple.parser compiler.units -combinators effects.parser slots hash-sets source-files ; +combinators effects effects.parser slots hash-sets source-files ; IN: bootstrap.syntax ! These words are defined as a top-level form, instead of with @@ -26,11 +26,15 @@ IN: bootstrap.syntax [ dup "syntax" lookup [ ] [ no-word-error ] ?if ] dip define-syntax ; +: verify-primitive ( word vocab effect -- ) + [ lookup ] dip [ swap stack-effect effect= ] curry [ f ] if* + [ "Primitive definition is not correct" throw ] unless ; + [ { "]" "}" ";" ">>" } [ define-delimiter ] each "PRIMITIVE:" [ - "Primitive definition is not supported" throw + scan-token current-vocab scan-object verify-primitive ] define-core-syntax "CS{" [