2008-09-10 23:11:03 -04:00
|
|
|
! Copyright (C) 2008 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: classes.tuple classes.tuple.parser kernel words
|
2009-03-01 21:12:35 -05:00
|
|
|
make fry sequences parser accessors effects ;
|
2008-09-15 02:54:48 -04:00
|
|
|
IN: compiler.cfg.instructions.syntax
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2008-10-24 10:17:06 -04:00
|
|
|
: insn-word ( -- word )
|
|
|
|
#! We want to put the insn tuple in compiler.cfg.instructions,
|
|
|
|
#! but we cannot have circularity between that vocabulary and
|
|
|
|
#! this one.
|
|
|
|
"insn" "compiler.cfg.instructions" lookup ;
|
2008-09-10 23:11:03 -04:00
|
|
|
|
2008-12-15 20:44:56 -05:00
|
|
|
: insn-effect ( word -- effect )
|
2009-05-29 14:11:34 -04:00
|
|
|
boa-effect in>> 2 head* f <effect> ;
|
2008-12-15 20:44:56 -05:00
|
|
|
|
2009-03-21 02:27:50 -04:00
|
|
|
SYNTAX: INSN:
|
2009-05-29 14:11:34 -04:00
|
|
|
parse-tuple-definition { "regs" "insn#" } append
|
2008-10-24 10:17:06 -04:00
|
|
|
[ dup tuple eq? [ drop insn-word ] when ] dip
|
2008-09-10 23:11:03 -04:00
|
|
|
[ define-tuple-class ]
|
|
|
|
[ 2drop save-location ]
|
2009-05-29 14:11:34 -04:00
|
|
|
[ 2drop [ ] [ '[ f f _ boa , ] ] [ insn-effect ] tri define-inline ]
|
2009-03-21 02:27:50 -04:00
|
|
|
3tri ;
|