factor: cleaning up more syntax.

locals-and-roots
Doug Coleman 2016-06-06 16:23:02 -07:00
parent 77db8f128f
commit 552d323897
31 changed files with 268 additions and 273 deletions

View File

@ -6,7 +6,7 @@ destructors io io.encodings.string io.encodings.utf8 kernel locals
math math.parser namespaces sequences strings ; math math.parser namespaces sequences strings ;
in: cuda.demos.hello-world in: cuda.demos.hello-world
CUDA-library: hello cuda32 "vocab:cuda/demos/hello-world/hello.ptx" CUDA-LIBRARY: hello cuda32 "vocab:cuda/demos/hello-world/hello.ptx" ;
CUDA-FUNCTION: helloWorld ( char* string-ptr ) ; CUDA-FUNCTION: helloWorld ( char* string-ptr ) ;

View File

@ -3,7 +3,7 @@
USING: alien.c-types cuda cuda.contexts cuda.libraries cuda.syntax locals ; USING: alien.c-types cuda cuda.contexts cuda.libraries cuda.syntax locals ;
in: cuda.demos.prefix-sum in: cuda.demos.prefix-sum
CUDA-library: prefix-sum cuda32 "vocab:cuda/demos/prefix-sum/prefix-sum.ptx" CUDA-LIBRARY: prefix-sum cuda32 "vocab:cuda/demos/prefix-sum/prefix-sum.ptx" ;
CUDA-FUNCTION: prefix_sum_block ( uint* in, uint* out, uint n ) ; CUDA-FUNCTION: prefix_sum_block ( uint* in, uint* out, uint n ) ;

View File

@ -8,7 +8,7 @@ PREDICATE: cuda-function-word < word
def>> { [ length 14 = ] [ last \ cuda-invoke eq? ] } 1&& ; def>> { [ length 14 = ] [ last \ cuda-invoke eq? ] } 1&& ;
: pprint-cuda-library ( library -- ) : pprint-cuda-library ( library -- )
[ \ CUDA-library: [ text ] pprint-prefix ] when* ; [ \ CUDA-LIBRARY: [ text ] pprint-prefix ] when* ;
: pprint-cuda-function ( word quot -- ) : pprint-cuda-function ( word quot -- )
[ [

View File

@ -4,15 +4,15 @@ USING: alien.parser cuda.libraries fry kernel lexer namespaces
parser ; parser ;
in: cuda.syntax in: cuda.syntax
SYNTAX: CUDA-library: SYNTAX: \ CUDA-LIBRARY:
scan-token scan-word scan-object scan-token scan-word scan-object ";" expect
'[ _ _ add-cuda-library ] '[ _ _ add-cuda-library ]
[ current-cuda-library set-global ] bi ; [ current-cuda-library set-global ] bi ;
SYNTAX: CUDA-FUNCTION: SYNTAX: \ CUDA-FUNCTION:
scan-token [ create-word-in current-cuda-library get ] keep scan-token [ create-word-in current-cuda-library get ] keep
scan-c-args ";" expect define-cuda-function ; scan-c-args ";" expect define-cuda-function ;
SYNTAX: CUDA-GLOBAL: SYNTAX: \ cuda-global:
scan-token [ create-word-in current-cuda-library get ] keep scan-token [ create-word-in current-cuda-library get ] keep
define-cuda-global ; define-cuda-global ;

View File

@ -65,9 +65,9 @@ M: word <c-direct-array>
M: pointer <c-direct-array> M: pointer <c-direct-array>
drop void* <c-direct-array> ; drop void* <c-direct-array> ;
SYNTAX: c-array{ \ } [ unclip >c-array ] parse-literal ; SYNTAX: \ c-array{ \ } [ unclip >c-array ] parse-literal ;
SYNTAX: c-array@ SYNTAX: \ c-array@
scan-object [ scan-object scan-object ] dip scan-object [ scan-object scan-object ] dip
<c-direct-array> suffix! ; <c-direct-array> suffix! ;

View File

@ -123,8 +123,8 @@ MACRO: data-map! ( ins outs -- quot )
PRIVATE> PRIVATE>
SYNTAX: data-map( SYNTAX: \ data-map(
parse-data-map-effect \ data-map suffix! ; parse-data-map-effect \ data-map suffix! ;
SYNTAX: data-map!( SYNTAX: \ data-map!(
parse-data-map-effect \ data-map! suffix! ; parse-data-map-effect \ data-map! suffix! ;

View File

@ -145,18 +145,18 @@ ERROR: unsupported-endian-type endian slot ;
[ compute-struct-offsets ] [ drop 1 ] [ compute-struct-offsets ] [ drop 1 ]
(define-struct-class) ; (define-struct-class) ;
SYNTAX: LE-STRUCT: SYNTAX: \ LE-STRUCT:
parse-struct-definition parse-struct-definition
little-endian define-endian-struct-class ; little-endian define-endian-struct-class ;
SYNTAX: BE-STRUCT: SYNTAX: \ BE-STRUCT:
parse-struct-definition parse-struct-definition
big-endian define-endian-struct-class ; big-endian define-endian-struct-class ;
SYNTAX: LE-PACKED-STRUCT: SYNTAX: \ LE-PACKED-STRUCT:
parse-struct-definition parse-struct-definition
little-endian define-endian-packed-struct-class ; little-endian define-endian-packed-struct-class ;
SYNTAX: BE-PACKED-STRUCT: SYNTAX: \ BE-PACKED-STRUCT:
parse-struct-definition parse-struct-definition
big-endian define-endian-packed-struct-class ; big-endian define-endian-packed-struct-class ;

View File

@ -440,20 +440,15 @@ MACRO: fortran-invoke ( return library function parameters -- quot )
return library function parameters return [ c:void ] unless* parse-arglist return library function parameters return [ c:void ] unless* parse-arglist
[ \ fortran-invoke 5 [ ] nsequence ] dip define-declared ; [ \ fortran-invoke 5 [ ] nsequence ] dip define-declared ;
SYNTAX: SUBROUTINE: SYNTAX: \ SUBROUTINE:
f current-library get scan-token ")" parse-tokens f current-library get scan-token ")" parse-tokens
[ "()" subseq? ] reject ";" expect define-fortran-function ; [ "()" subseq? ] reject ";" expect define-fortran-function ;
SYNTAX: FUNCTION: SYNTAX: \ FUNCTION:
scan-token current-library get scan-token ")" parse-tokens scan-token current-library get scan-token ")" parse-tokens
[ "()" subseq? ] reject ";" expect define-fortran-function ; [ "()" subseq? ] reject ";" expect define-fortran-function ;
SYNTAX: library: SYNTAX: \ library:
scan-token
[ current-library set ]
[ set-fortran-abi ] bi ;
SYNTAX: library:
scan-token scan-token
[ current-library set ] [ current-library set ]
[ set-fortran-abi ] bi ; [ set-fortran-abi ] bi ;

View File

@ -6,41 +6,41 @@ strings.parser vocabs words ;
<< "alien.arrays" require >> ! needed for bootstrap << "alien.arrays" require >> ! needed for bootstrap
in: alien.syntax in: alien.syntax
SYNTAX: DLL" lexer get skip-blank parse-string dlopen suffix! ; SYNTAX: \ DLL" lexer get skip-blank parse-string dlopen suffix! ;
SYNTAX: ALIEN: 16 scan-base <alien> suffix! ; SYNTAX: \ ALIEN: 16 scan-base <alien> suffix! ;
SYNTAX: alien: 16 scan-base <alien> suffix! ; SYNTAX: \ alien: 16 scan-base <alien> suffix! ;
SYNTAX: BAD-ALIEN <bad-alien> suffix! ; SYNTAX: BAD-ALIEN <bad-alien> suffix! ;
SYNTAX: LIBRARY: scan-token current-library set ; SYNTAX: \ LIBRARY: scan-token current-library set ;
SYNTAX: library: scan-token current-library set ; SYNTAX: \ library: scan-token current-library set ;
SYNTAX: FUNCTION: SYNTAX: \ FUNCTION:
(FUNCTION:) make-function define-inline ; (FUNCTION:) make-function define-inline ;
SYNTAX: FUNCTION-ALIAS: SYNTAX: \ FUNCTION-ALIAS:
scan-token create-function scan-token create-function
(FUNCTION:) (make-function) define-inline ; (FUNCTION:) (make-function) define-inline ;
SYNTAX: CALLBACK: SYNTAX: \ CALLBACK:
(CALLBACK:) define-inline ; (CALLBACK:) define-inline ;
SYNTAX: TYPEDEF: SYNTAX: \ TYPEDEF:
scan-c-type CREATE-C-TYPE ";" expect dup save-location typedef ; scan-c-type CREATE-C-TYPE ";" expect dup save-location typedef ;
SYNTAX: ENUM: SYNTAX: \ ENUM:
parse-enum (define-enum) ; parse-enum (define-enum) ;
SYNTAX: C-TYPE: SYNTAX: \ C-TYPE:
void CREATE-C-TYPE typedef ; void CREATE-C-TYPE typedef ;
SYNTAX: c-type: SYNTAX: \ c-type:
void CREATE-C-TYPE typedef ; void CREATE-C-TYPE typedef ;
SYNTAX: &: SYNTAX: \ &:
scan-token current-library get '[ _ _ address-of ] append! ; scan-token current-library get '[ _ _ address-of ] append! ;
SYNTAX: C-GLOBAL: scan-c-type scan-new-word ";" expect define-global ; SYNTAX: \ C-GLOBAL: scan-c-type scan-new-word ";" expect define-global ;
SYNTAX: pointer: SYNTAX: \ pointer:
scan-c-type <pointer> suffix! ; scan-c-type <pointer> suffix! ;

View File

@ -378,19 +378,19 @@ PRIVATE>
dup [ name>> ] map check-duplicate-slots ; dup [ name>> ] map check-duplicate-slots ;
PRIVATE> PRIVATE>
SYNTAX: STRUCT: SYNTAX: \ STRUCT:
parse-struct-definition define-struct-class ; parse-struct-definition define-struct-class ;
SYNTAX: PACKED-STRUCT: SYNTAX: \ PACKED-STRUCT:
parse-struct-definition define-packed-struct-class ; parse-struct-definition define-packed-struct-class ;
SYNTAX: UNION-STRUCT: SYNTAX: \ UNION-STRUCT:
parse-struct-definition define-union-struct-class ; parse-struct-definition define-union-struct-class ;
SYNTAX: S{ SYNTAX: \ S{
scan-word dup struct-slots parse-tuple-literal-slots suffix! ; scan-word dup struct-slots parse-tuple-literal-slots suffix! ;
SYNTAX: S@ SYNTAX: \ S@
scan-word scan-object swap memory>struct suffix! ; scan-word scan-object swap memory>struct suffix! ;
! functor support ! functor support
@ -412,7 +412,7 @@ SYNTAX: S@
PRIVATE> PRIVATE>
FUNCTOR-SYNTAX: STRUCT: FUNCTOR-SYNTAX: \ STRUCT:
scan-param suffix! scan-param suffix!
[ 8 <vector> ] append! [ 8 <vector> ] append!
[ parse-struct-slots* ] [ ] while [ parse-struct-slots* ] [ ] while

View File

@ -113,5 +113,5 @@ M: T-array struct-transpose
FUNCTOR; FUNCTOR;
SYNTAX: VECTORED-STRUCT: SYNTAX: \ VECTORED-STRUCT:
scan-word define-vectored-struct ; scan-word define-vectored-struct ;

View File

@ -88,14 +88,14 @@ TUPLE: insn-slot-spec type name rep ;
[ nip define-insn-ctor ] [ nip define-insn-ctor ]
} 3cleave ; } 3cleave ;
SYNTAX: INSN: SYNTAX: \ INSN:
scan-new-class insn-word ";" parse-tokens define-insn ; scan-new-class insn-word ";" parse-tokens define-insn ;
SYNTAX: VREG-INSN: SYNTAX: \ VREG-INSN:
scan-new-class vreg-insn-word ";" parse-tokens define-insn ; scan-new-class vreg-insn-word ";" parse-tokens define-insn ;
SYNTAX: FLUSHABLE-INSN: SYNTAX: \ FLUSHABLE-INSN:
scan-new-class flushable-insn-word ";" parse-tokens define-insn ; scan-new-class flushable-insn-word ";" parse-tokens define-insn ;
SYNTAX: FOLDABLE-INSN: SYNTAX: \ FOLDABLE-INSN:
scan-new-class foldable-insn-word ";" parse-tokens define-insn ; scan-new-class foldable-insn-word ";" parse-tokens define-insn ;

View File

@ -32,7 +32,7 @@ C: <ds-loc> ds-loc ;
TUPLE: rs-loc < loc ; TUPLE: rs-loc < loc ;
C: <rs-loc> rs-loc ; C: <rs-loc> rs-loc ;
SYNTAX: D: scan-number <ds-loc> suffix! ; SYNTAX: \ D: scan-number <ds-loc> suffix! ;
SYNTAX: d: scan-number <ds-loc> suffix! ; SYNTAX: \ d: scan-number <ds-loc> suffix! ;
SYNTAX: R: scan-number <rs-loc> suffix! ; SYNTAX: \ R: scan-number <rs-loc> suffix! ;
SYNTAX: r: scan-number <rs-loc> suffix! ; SYNTAX: \ r: scan-number <rs-loc> suffix! ;

View File

@ -85,4 +85,4 @@ insn-classes get [ insn-temp-slots empty? ] reject [
FUNCTOR; FUNCTOR;
SYNTAX: RENAMING: scan-token scan-object scan-object scan-object ";" expect define-renaming ; SYNTAX: \ RENAMING: scan-token scan-object scan-object scan-object ";" expect define-renaming ;

View File

@ -7,7 +7,7 @@ compiler.codegen.gc-maps compiler.codegen.labels
compiler.codegen.relocation compiler.constants cpu.architecture compiler.codegen.relocation compiler.constants cpu.architecture
fry generic.parser kernel layouts locals make math namespaces fry generic.parser kernel layouts locals make math namespaces
parser quotations sequences sequences.generalizations slots parser quotations sequences sequences.generalizations slots
words ; words lexer ;
in: compiler.codegen in: compiler.codegen
symbol: insn-counts symbol: insn-counts
@ -128,185 +128,185 @@ M: ##epilogue generate-insn
[ insn-slot-quot ] map cleave>quot [ insn-slot-quot ] map cleave>quot
] dip suffix ; ] dip suffix ;
SYNTAX: CODEGEN: SYNTAX: \ CODEGEN:
scan-word [ \ generate-insn create-method-in ] keep scan-word scan-word [ \ generate-insn create-method-in ] keep scan-word ";" expect
codegen-method-body define ; codegen-method-body define ;
>> >>
CODEGEN: ##load-integer %load-immediate CODEGEN: ##load-integer %load-immediate ;
CODEGEN: ##load-tagged %load-immediate CODEGEN: ##load-tagged %load-immediate ;
CODEGEN: ##load-reference %load-reference CODEGEN: ##load-reference %load-reference ;
CODEGEN: ##load-float %load-float CODEGEN: ##load-float %load-float ;
CODEGEN: ##load-double %load-double CODEGEN: ##load-double %load-double ;
CODEGEN: ##load-vector %load-vector CODEGEN: ##load-vector %load-vector ;
CODEGEN: ##peek %peek CODEGEN: ##peek %peek ;
CODEGEN: ##replace %replace CODEGEN: ##replace %replace ;
CODEGEN: ##replace-imm %replace-imm CODEGEN: ##replace-imm %replace-imm ;
CODEGEN: ##clear %clear CODEGEN: ##clear %clear ;
CODEGEN: ##inc %inc CODEGEN: ##inc %inc ;
CODEGEN: ##call %call CODEGEN: ##call %call ;
CODEGEN: ##jump %jump CODEGEN: ##jump %jump ;
CODEGEN: ##return %return CODEGEN: ##return %return ;
CODEGEN: ##safepoint %safepoint CODEGEN: ##safepoint %safepoint ;
CODEGEN: ##slot %slot CODEGEN: ##slot %slot ;
CODEGEN: ##slot-imm %slot-imm CODEGEN: ##slot-imm %slot-imm ;
CODEGEN: ##set-slot %set-slot CODEGEN: ##set-slot %set-slot ;
CODEGEN: ##set-slot-imm %set-slot-imm CODEGEN: ##set-slot-imm %set-slot-imm ;
CODEGEN: ##add %add CODEGEN: ##add %add ;
CODEGEN: ##add-imm %add-imm CODEGEN: ##add-imm %add-imm ;
CODEGEN: ##sub %sub CODEGEN: ##sub %sub ;
CODEGEN: ##sub-imm %sub-imm CODEGEN: ##sub-imm %sub-imm ;
CODEGEN: ##mul %mul CODEGEN: ##mul %mul ;
CODEGEN: ##mul-imm %mul-imm CODEGEN: ##mul-imm %mul-imm ;
CODEGEN: ##and %and CODEGEN: ##and %and ;
CODEGEN: ##and-imm %and-imm CODEGEN: ##and-imm %and-imm ;
CODEGEN: ##or %or CODEGEN: ##or %or ;
CODEGEN: ##or-imm %or-imm CODEGEN: ##or-imm %or-imm ;
CODEGEN: ##xor %xor CODEGEN: ##xor %xor ;
CODEGEN: ##xor-imm %xor-imm CODEGEN: ##xor-imm %xor-imm ;
CODEGEN: ##shl %shl CODEGEN: ##shl %shl ;
CODEGEN: ##shl-imm %shl-imm CODEGEN: ##shl-imm %shl-imm ;
CODEGEN: ##shr %shr CODEGEN: ##shr %shr ;
CODEGEN: ##shr-imm %shr-imm CODEGEN: ##shr-imm %shr-imm ;
CODEGEN: ##sar %sar CODEGEN: ##sar %sar ;
CODEGEN: ##sar-imm %sar-imm CODEGEN: ##sar-imm %sar-imm ;
CODEGEN: ##min %min CODEGEN: ##min %min ;
CODEGEN: ##max %max CODEGEN: ##max %max ;
CODEGEN: ##not %not CODEGEN: ##not %not ;
CODEGEN: ##neg %neg CODEGEN: ##neg %neg ;
CODEGEN: ##log2 %log2 CODEGEN: ##log2 %log2 ;
CODEGEN: ##bit-count %bit-count CODEGEN: ##bit-count %bit-count ;
CODEGEN: ##bit-test %bit-test CODEGEN: ##bit-test %bit-test ;
CODEGEN: ##copy %copy CODEGEN: ##copy %copy ;
CODEGEN: ##tagged>integer %tagged>integer CODEGEN: ##tagged>integer %tagged>integer ;
CODEGEN: ##add-float %add-float CODEGEN: ##add-float %add-float ;
CODEGEN: ##sub-float %sub-float CODEGEN: ##sub-float %sub-float ;
CODEGEN: ##mul-float %mul-float CODEGEN: ##mul-float %mul-float ;
CODEGEN: ##div-float %div-float CODEGEN: ##div-float %div-float ;
CODEGEN: ##min-float %min-float CODEGEN: ##min-float %min-float ;
CODEGEN: ##max-float %max-float CODEGEN: ##max-float %max-float ;
CODEGEN: ##sqrt %sqrt CODEGEN: ##sqrt %sqrt ;
CODEGEN: ##single>double-float %single>double-float CODEGEN: ##single>double-float %single>double-float ;
CODEGEN: ##double>single-float %double>single-float CODEGEN: ##double>single-float %double>single-float ;
CODEGEN: ##integer>float %integer>float CODEGEN: ##integer>float %integer>float ;
CODEGEN: ##float>integer %float>integer CODEGEN: ##float>integer %float>integer ;
CODEGEN: ##zero-vector %zero-vector CODEGEN: ##zero-vector %zero-vector ;
CODEGEN: ##fill-vector %fill-vector CODEGEN: ##fill-vector %fill-vector ;
CODEGEN: ##gather-vector-2 %gather-vector-2 CODEGEN: ##gather-vector-2 %gather-vector-2 ;
CODEGEN: ##gather-vector-4 %gather-vector-4 CODEGEN: ##gather-vector-4 %gather-vector-4 ;
CODEGEN: ##gather-int-vector-2 %gather-int-vector-2 CODEGEN: ##gather-int-vector-2 %gather-int-vector-2 ;
CODEGEN: ##gather-int-vector-4 %gather-int-vector-4 CODEGEN: ##gather-int-vector-4 %gather-int-vector-4 ;
CODEGEN: ##select-vector %select-vector CODEGEN: ##select-vector %select-vector ;
CODEGEN: ##shuffle-vector-imm %shuffle-vector-imm CODEGEN: ##shuffle-vector-imm %shuffle-vector-imm ;
CODEGEN: ##shuffle-vector-halves-imm %shuffle-vector-halves-imm CODEGEN: ##shuffle-vector-halves-imm %shuffle-vector-halves-imm ;
CODEGEN: ##shuffle-vector %shuffle-vector CODEGEN: ##shuffle-vector %shuffle-vector ;
CODEGEN: ##tail>head-vector %tail>head-vector CODEGEN: ##tail>head-vector %tail>head-vector ;
CODEGEN: ##merge-vector-head %merge-vector-head CODEGEN: ##merge-vector-head %merge-vector-head ;
CODEGEN: ##merge-vector-tail %merge-vector-tail CODEGEN: ##merge-vector-tail %merge-vector-tail ;
CODEGEN: ##float-pack-vector %float-pack-vector CODEGEN: ##float-pack-vector %float-pack-vector ;
CODEGEN: ##signed-pack-vector %signed-pack-vector CODEGEN: ##signed-pack-vector %signed-pack-vector ;
CODEGEN: ##unsigned-pack-vector %unsigned-pack-vector CODEGEN: ##unsigned-pack-vector %unsigned-pack-vector ;
CODEGEN: ##unpack-vector-head %unpack-vector-head CODEGEN: ##unpack-vector-head %unpack-vector-head ;
CODEGEN: ##unpack-vector-tail %unpack-vector-tail CODEGEN: ##unpack-vector-tail %unpack-vector-tail ;
CODEGEN: ##integer>float-vector %integer>float-vector CODEGEN: ##integer>float-vector %integer>float-vector ;
CODEGEN: ##float>integer-vector %float>integer-vector CODEGEN: ##float>integer-vector %float>integer-vector ;
CODEGEN: ##compare-vector %compare-vector CODEGEN: ##compare-vector %compare-vector ;
CODEGEN: ##move-vector-mask %move-vector-mask CODEGEN: ##move-vector-mask %move-vector-mask ;
CODEGEN: ##test-vector %test-vector CODEGEN: ##test-vector %test-vector ;
CODEGEN: ##add-vector %add-vector CODEGEN: ##add-vector %add-vector ;
CODEGEN: ##saturated-add-vector %saturated-add-vector CODEGEN: ##saturated-add-vector %saturated-add-vector ;
CODEGEN: ##add-sub-vector %add-sub-vector CODEGEN: ##add-sub-vector %add-sub-vector ;
CODEGEN: ##sub-vector %sub-vector CODEGEN: ##sub-vector %sub-vector ;
CODEGEN: ##saturated-sub-vector %saturated-sub-vector CODEGEN: ##saturated-sub-vector %saturated-sub-vector ;
CODEGEN: ##mul-vector %mul-vector CODEGEN: ##mul-vector %mul-vector ;
CODEGEN: ##mul-high-vector %mul-high-vector CODEGEN: ##mul-high-vector %mul-high-vector ;
CODEGEN: ##mul-horizontal-add-vector %mul-horizontal-add-vector CODEGEN: ##mul-horizontal-add-vector %mul-horizontal-add-vector ;
CODEGEN: ##saturated-mul-vector %saturated-mul-vector CODEGEN: ##saturated-mul-vector %saturated-mul-vector ;
CODEGEN: ##div-vector %div-vector CODEGEN: ##div-vector %div-vector ;
CODEGEN: ##min-vector %min-vector CODEGEN: ##min-vector %min-vector ;
CODEGEN: ##max-vector %max-vector CODEGEN: ##max-vector %max-vector ;
CODEGEN: ##avg-vector %avg-vector CODEGEN: ##avg-vector %avg-vector ;
CODEGEN: ##dot-vector %dot-vector CODEGEN: ##dot-vector %dot-vector ;
CODEGEN: ##sad-vector %sad-vector CODEGEN: ##sad-vector %sad-vector ;
CODEGEN: ##sqrt-vector %sqrt-vector CODEGEN: ##sqrt-vector %sqrt-vector ;
CODEGEN: ##horizontal-add-vector %horizontal-add-vector CODEGEN: ##horizontal-add-vector %horizontal-add-vector ;
CODEGEN: ##horizontal-sub-vector %horizontal-sub-vector CODEGEN: ##horizontal-sub-vector %horizontal-sub-vector ;
CODEGEN: ##horizontal-shl-vector-imm %horizontal-shl-vector-imm CODEGEN: ##horizontal-shl-vector-imm %horizontal-shl-vector-imm ;
CODEGEN: ##horizontal-shr-vector-imm %horizontal-shr-vector-imm CODEGEN: ##horizontal-shr-vector-imm %horizontal-shr-vector-imm ;
CODEGEN: ##abs-vector %abs-vector CODEGEN: ##abs-vector %abs-vector ;
CODEGEN: ##and-vector %and-vector CODEGEN: ##and-vector %and-vector ;
CODEGEN: ##andn-vector %andn-vector CODEGEN: ##andn-vector %andn-vector ;
CODEGEN: ##or-vector %or-vector CODEGEN: ##or-vector %or-vector ;
CODEGEN: ##xor-vector %xor-vector CODEGEN: ##xor-vector %xor-vector ;
CODEGEN: ##not-vector %not-vector CODEGEN: ##not-vector %not-vector ;
CODEGEN: ##shl-vector-imm %shl-vector-imm CODEGEN: ##shl-vector-imm %shl-vector-imm ;
CODEGEN: ##shr-vector-imm %shr-vector-imm CODEGEN: ##shr-vector-imm %shr-vector-imm ;
CODEGEN: ##shl-vector %shl-vector CODEGEN: ##shl-vector %shl-vector ;
CODEGEN: ##shr-vector %shr-vector CODEGEN: ##shr-vector %shr-vector ;
CODEGEN: ##integer>scalar %integer>scalar CODEGEN: ##integer>scalar %integer>scalar ;
CODEGEN: ##scalar>integer %scalar>integer CODEGEN: ##scalar>integer %scalar>integer ;
CODEGEN: ##vector>scalar %vector>scalar CODEGEN: ##vector>scalar %vector>scalar ;
CODEGEN: ##scalar>vector %scalar>vector CODEGEN: ##scalar>vector %scalar>vector ;
CODEGEN: ##box-alien %box-alien CODEGEN: ##box-alien %box-alien ;
CODEGEN: ##box-displaced-alien %box-displaced-alien CODEGEN: ##box-displaced-alien %box-displaced-alien ;
CODEGEN: ##unbox-alien %unbox-alien CODEGEN: ##unbox-alien %unbox-alien ;
CODEGEN: ##unbox-any-c-ptr %unbox-any-c-ptr CODEGEN: ##unbox-any-c-ptr %unbox-any-c-ptr ;
CODEGEN: ##convert-integer %convert-integer CODEGEN: ##convert-integer %convert-integer ;
CODEGEN: ##load-memory %load-memory CODEGEN: ##load-memory %load-memory ;
CODEGEN: ##load-memory-imm %load-memory-imm CODEGEN: ##load-memory-imm %load-memory-imm ;
CODEGEN: ##store-memory %store-memory CODEGEN: ##store-memory %store-memory ;
CODEGEN: ##store-memory-imm %store-memory-imm CODEGEN: ##store-memory-imm %store-memory-imm ;
CODEGEN: ##allot %allot CODEGEN: ##allot %allot ;
CODEGEN: ##write-barrier %write-barrier CODEGEN: ##write-barrier %write-barrier ;
CODEGEN: ##write-barrier-imm %write-barrier-imm CODEGEN: ##write-barrier-imm %write-barrier-imm ;
CODEGEN: ##compare %compare CODEGEN: ##compare %compare ;
CODEGEN: ##compare-imm %compare-imm CODEGEN: ##compare-imm %compare-imm ;
CODEGEN: ##test %test CODEGEN: ##test %test ;
CODEGEN: ##test-imm %test-imm CODEGEN: ##test-imm %test-imm ;
CODEGEN: ##compare-integer %compare CODEGEN: ##compare-integer %compare ;
CODEGEN: ##compare-integer-imm %compare-integer-imm CODEGEN: ##compare-integer-imm %compare-integer-imm ;
CODEGEN: ##compare-float-ordered %compare-float-ordered CODEGEN: ##compare-float-ordered %compare-float-ordered ;
CODEGEN: ##compare-float-unordered %compare-float-unordered CODEGEN: ##compare-float-unordered %compare-float-unordered ;
CODEGEN: ##save-context %save-context CODEGEN: ##save-context %save-context ;
CODEGEN: ##vm-field %vm-field CODEGEN: ##vm-field %vm-field ;
CODEGEN: ##set-vm-field %set-vm-field CODEGEN: ##set-vm-field %set-vm-field ;
CODEGEN: ##alien-global %alien-global CODEGEN: ##alien-global %alien-global ;
CODEGEN: ##call-gc %call-gc CODEGEN: ##call-gc %call-gc ;
CODEGEN: ##spill %spill CODEGEN: ##spill %spill ;
CODEGEN: ##reload %reload CODEGEN: ##reload %reload ;
! Conditional branches ! Conditional branches
<< <<
SYNTAX: CONDITIONAL: SYNTAX: \ CONDITIONAL:
scan-word [ \ generate-conditional-insn create-method-in ] keep scan-word scan-word [ \ generate-conditional-insn create-method-in ] keep scan-word ";" expect
codegen-method-body define ; codegen-method-body define ;
>> >>
CONDITIONAL: ##compare-branch %compare-branch CONDITIONAL: ##compare-branch %compare-branch ;
CONDITIONAL: ##compare-imm-branch %compare-imm-branch CONDITIONAL: ##compare-imm-branch %compare-imm-branch ;
CONDITIONAL: ##compare-integer-branch %compare-branch CONDITIONAL: ##compare-integer-branch %compare-branch ;
CONDITIONAL: ##compare-integer-imm-branch %compare-integer-imm-branch CONDITIONAL: ##compare-integer-imm-branch %compare-integer-imm-branch ;
CONDITIONAL: ##test-branch %test-branch CONDITIONAL: ##test-branch %test-branch ;
CONDITIONAL: ##test-imm-branch %test-imm-branch CONDITIONAL: ##test-imm-branch %test-imm-branch ;
CONDITIONAL: ##compare-float-ordered-branch %compare-float-ordered-branch CONDITIONAL: ##compare-float-ordered-branch %compare-float-ordered-branch ;
CONDITIONAL: ##compare-float-unordered-branch %compare-float-unordered-branch CONDITIONAL: ##compare-float-unordered-branch %compare-float-unordered-branch ;
CONDITIONAL: ##test-vector-branch %test-vector-branch CONDITIONAL: ##test-vector-branch %test-vector-branch ;
CONDITIONAL: ##check-nursery-branch %check-nursery-branch CONDITIONAL: ##check-nursery-branch %check-nursery-branch ;
CONDITIONAL: ##fixnum-add %fixnum-add CONDITIONAL: ##fixnum-add %fixnum-add ;
CONDITIONAL: ##fixnum-sub %fixnum-sub CONDITIONAL: ##fixnum-sub %fixnum-sub ;
CONDITIONAL: ##fixnum-mul %fixnum-mul CONDITIONAL: ##fixnum-mul %fixnum-mul ;
! FFI ! FFI
CODEGEN: ##unbox %unbox CODEGEN: ##unbox %unbox ;
CODEGEN: ##unbox-long-long %unbox-long-long CODEGEN: ##unbox-long-long %unbox-long-long ;
CODEGEN: ##local-allot %local-allot CODEGEN: ##local-allot %local-allot ;
CODEGEN: ##box %box CODEGEN: ##box %box ;
CODEGEN: ##box-long-long %box-long-long CODEGEN: ##box-long-long %box-long-long ;
CODEGEN: ##alien-invoke %alien-invoke CODEGEN: ##alien-invoke %alien-invoke ;
CODEGEN: ##alien-indirect %alien-indirect CODEGEN: ##alien-indirect %alien-indirect ;
CODEGEN: ##alien-assembly %alien-assembly CODEGEN: ##alien-assembly %alien-assembly ;
CODEGEN: ##callback-inputs %callback-inputs CODEGEN: ##callback-inputs %callback-inputs ;
CODEGEN: ##callback-outputs %callback-outputs CODEGEN: ##callback-outputs %callback-outputs ;

View File

@ -1381,13 +1381,13 @@ symbol: last-opcode
dup last-instruction set-global dup last-instruction set-global
] dip ( cpu -- ) define-declared ; ] dip ( cpu -- ) define-declared ;
SYNTAX: INSTRUCTION: ";" parse-tokens parse-instructions ; SYNTAX: \ INSTRUCTION: ";" parse-tokens parse-instructions ;
SYNTAX: cycles: SYNTAX: \ cycles:
! Set the number of cycles for the last instruction that was defined. ! Set the number of cycles for the last instruction that was defined.
scan-token string>number last-opcode get-global instruction-cycles set-nth ; scan-token string>number last-opcode get-global instruction-cycles set-nth ;
SYNTAX: opcode: SYNTAX: \ opcode:
! Set the opcode number for the last instruction that was defined. ! Set the opcode number for the last instruction that was defined.
last-instruction get-global 1quotation scan-token hex> last-instruction get-global 1quotation scan-token hex>
dup last-opcode set-global set-instruction ; dup last-opcode set-global set-instruction ;

View File

@ -22,8 +22,8 @@ registers [ H{ } clone ] initialize
: define-registers ( names size -- ) : define-registers ( names size -- )
[ [ 0 ] dip (define-registers) ] keep registers get set-at ; [ [ 0 ] dip (define-registers) ] keep registers get set-at ;
SYNTAX: REGISTERS: SYNTAX: \ REGISTERS:
scan-number [ ";" parse-tokens ] dip define-registers ; scan-number [ ";" parse-tokens ] dip define-registers ;
SYNTAX: HI-REGISTERS: SYNTAX: \ HI-REGISTERS:
scan-number [ ";" parse-tokens 4 ] dip (define-registers) drop ; scan-number [ ";" parse-tokens 4 ] dip (define-registers) drop ;

View File

@ -24,7 +24,7 @@ icons [ H{ } clone ] initialize
define define
] 2bi ; ] 2bi ;
SYNTAX: ICON: scan-word scan-token ";" expect define-icon ; SYNTAX: \ ICON: scan-word scan-token ";" expect define-icon ;
>> >>

View File

@ -63,6 +63,6 @@ symbol: euc-table
PRIVATE> PRIVATE>
SYNTAX: EUC: SYNTAX: \ EUC:
! EUC: euc-kr "vocab:io/encodings/korean/cp949.txt" ; ! EUC: euc-kr "vocab:io/encodings/korean/cp949.txt" ;
scan-new-class scan-object ";" expect define-euc ; scan-new-class scan-object ";" expect define-euc ;

View File

@ -537,18 +537,18 @@ ERROR: could-not-parse-ebnf ;
PRIVATE> PRIVATE>
SYNTAX: <EBNF SYNTAX: \ EBNF<
"EBNF>" "EBNF>"
reset-tokenizer parse-multiline-string parse-ebnf main of reset-tokenizer parse-multiline-string parse-ebnf main of
suffix! reset-tokenizer ; suffix! reset-tokenizer ;
SYNTAX: [EBNF SYNTAX: \ EBNF[
"EBNF]" "EBNF]"
reset-tokenizer parse-multiline-string ebnf>quot nip reset-tokenizer parse-multiline-string ebnf>quot nip
suffix! \ call suffix! reset-tokenizer ; suffix! \ call suffix! reset-tokenizer ;
SYNTAX: EBNF: SYNTAX: \ EBNF:
reset-tokenizer scan-new-word dup ";EBNF" parse-multiline-string reset-tokenizer scan-new-word dup "EBNF;" parse-multiline-string
ebnf>quot swapd ebnf>quot swapd
( input -- ast ) define-declared "ebnf-parser" set-word-prop ( input -- ast ) define-declared "ebnf-parser" set-word-prop
reset-tokenizer ; reset-tokenizer ;

View File

@ -14,7 +14,7 @@ GENERIC: variable-setter ( word -- word' ) ;
M: variable variable-setter "variable-setter" word-prop ; M: variable variable-setter "variable-setter" word-prop ;
M: local-reader variable-setter "local-writer" word-prop ; M: local-reader variable-setter "local-writer" word-prop ;
SYNTAX: set: SYNTAX: \ set:
scan-object variable-setter suffix! ; scan-object variable-setter suffix! ;
: [variable-getter] ( variable -- quot ) : [variable-getter] ( variable -- quot )
@ -34,10 +34,10 @@ SYNTAX: set:
: define-variable ( word -- ) : define-variable ( word -- )
dup [ [variable-getter] ] [ [variable-setter] ] bi (define-variable) ; dup [ [variable-getter] ] [ [variable-setter] ] bi (define-variable) ;
SYNTAX: VAR: SYNTAX: \ var:
scan-new-word define-variable ; scan-new-word define-variable ;
M: variable definer drop \ VAR: f ; M: variable definer drop \ var: f ;
M: variable definition drop f ; M: variable definition drop f ;
M: variable link-effect? drop f ; M: variable link-effect? drop f ;
M: variable print-stack-effect? drop f ; M: variable print-stack-effect? drop f ;
@ -58,8 +58,8 @@ PREDICATE: typed-variable < variable
[ initial-value drop swap set-global ] [ initial-value drop swap set-global ]
} 2cleave (define-variable) ; } 2cleave (define-variable) ;
SYNTAX: TYPED-VAR: SYNTAX: \ TYPED-VAR:
scan-new-word scan-object define-typed-variable ; scan-new-word scan-object ";" expect define-typed-variable ;
M: typed-variable definer drop \ TYPED-VAR: f ; M: typed-variable definer drop \ TYPED-VAR: f ;
M: typed-variable definition "variable-type" word-prop 1quotation ; M: typed-variable definition "variable-type" word-prop 1quotation ;
@ -77,10 +77,10 @@ PREDICATE: global-variable < variable
: define-global ( word -- ) : define-global ( word -- )
global-box new [ [global-getter] ] [ [global-setter] ] bi (define-variable) ; global-box new [ [global-getter] ] [ [global-setter] ] bi (define-variable) ;
SYNTAX: GLOBAL: SYNTAX: \ global:
scan-new-word define-global ; scan-new-word define-global ;
M: global-variable definer drop \ GLOBAL: f ; M: global-variable definer drop \ global: f ;
INTERSECTION: typed-global-variable INTERSECTION: typed-global-variable
global-variable typed-variable ; global-variable typed-variable ;
@ -91,7 +91,7 @@ INTERSECTION: typed-global-variable
[ [ [global-getter] ] dip [typed-getter] ] [ [ [global-getter] ] dip [typed-getter] ]
[ [ [global-setter] ] dip [typed-setter] ] 2bi (define-variable) ; [ [ [global-setter] ] dip [typed-setter] ] 2bi (define-variable) ;
SYNTAX: TYPED-GLOBAL: SYNTAX: \ TYPED-GLOBAL:
scan-new-word scan-object define-typed-global ; scan-new-word scan-object ";" expect define-typed-global ;
M: typed-global-variable definer drop \ TYPED-GLOBAL: f ; M: typed-global-variable definer drop \ TYPED-GLOBAL: f ;

View File

@ -42,12 +42,12 @@ M: variant-class initial-value*
[ scan-token dup ";" = not ] [ scan-token dup ";" = not ]
[ parse-variant-member ] produce nip ; [ parse-variant-member ] produce nip ;
SYNTAX: VARIANT: SYNTAX: \ VARIANT:
scan-new-class scan-new-class
parse-variant-members parse-variant-members
define-variant-class-members ; define-variant-class-members ;
SYNTAX: VARIANT-MEMBER: SYNTAX: \ VARIANT-MEMBER:
scan-word scan-word
scan-token parse-variant-member scan-token parse-variant-member
define-variant-class-member ";" expect ; define-variant-class-member ";" expect ;

View File

@ -64,13 +64,13 @@ VALUE: rotation-step
3 \ translation-step set-value 3 \ translation-step set-value
5 \ rotation-step set-value 5 \ rotation-step set-value
VAR: selected-file-model var: selected-file-model
VAR: observer3d var: observer3d
VAR: view1 var: view1
VAR: view2 var: view2
VAR: view3 var: view3
VAR: view4 var: view4
VAR: present-space var: present-space
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@ -47,7 +47,7 @@ $nl
{ {
$unchecked-example $unchecked-example
"VAR: my-camera" "var: my-camera"
": init-my-camera ( -- )" ": init-my-camera ( -- )"
" <turtle> >my-camera" " <turtle> >my-camera"
" [ my-camera> >self" " [ my-camera> >self"

View File

@ -5,7 +5,7 @@ in: 4DNav.turtle
! replacement of self ! replacement of self
VAR: self var: self
: with-self ( quot obj -- ) [ >self call ] with-scope ; inline : with-self ( quot obj -- ) [ >self call ] with-scope ; inline

View File

@ -37,8 +37,8 @@ tools.walker
in: adsoda in: adsoda
DEFER: combinations defer: combinations
VAR: pv var: pv
! ------------------------------------------------------------- ! -------------------------------------------------------------

View File

@ -8,7 +8,7 @@ in: automata
! set-rule ! set-rule
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: rule VAR: rule-number var: rule var: rule-number
: init-rule ( -- ) 8 <hashtable> >rule ; : init-rule ( -- ) 8 <hashtable> >rule ;
@ -70,9 +70,9 @@ VARS: width height ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: bitmap var: bitmap
VAR: last-line var: last-line
: run-rule ( -- ) : run-rule ( -- )
last-line> height> [ drop step-capped-line dup ] map >bitmap >last-line ; last-line> height> [ drop step-capped-line dup ] map >bitmap >last-line ;
@ -85,7 +85,7 @@ VAR: last-line
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! VAR: loop-flag ! var: loop-flag
! DEFER: loop ! DEFER: loop

View File

@ -34,7 +34,7 @@ in: automata.ui
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: slate var: slate
! Call a 'model' quotation with the current 'view'. ! Call a 'model' quotation with the current 'view'.

View File

@ -45,7 +45,7 @@ SELF-SLOTS: hsva
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: color-stack var: color-stack
: init-color-stack ( -- ) V{ } clone >color-stack ; : init-color-stack ( -- ) V{ } clone >color-stack ;
@ -62,7 +62,7 @@ VAR: color-stack
: check-size ( modelview -- num ) { 0 1 4 5 } double-nth* [ abs ] map supremum ; : check-size ( modelview -- num ) { 0 1 4 5 } double-nth* [ abs ] map supremum ;
VAR: threshold var: threshold
: iterate? ( -- ? ) get-modelview-matrix check-size threshold> > ; : iterate? ( -- ? ) get-modelview-matrix check-size threshold> > ;
@ -162,7 +162,7 @@ MACRO: rule ( seq -- quot ) [rule] ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: background var: background
: set-initial-background ( -- ) T{ hsva f 0 0 1 1 } clone >self ; : set-initial-background ( -- ) T{ hsva f 0 0 1 1 } clone >self ;
@ -175,9 +175,9 @@ VAR: background
USING: rewrite-closures ; USING: rewrite-closures ;
VAR: viewport ! { left width bottom height } var: viewport ! { left width bottom height }
VAR: start-shape var: start-shape
: set-initial-color ( -- ) T{ hsva f 0 0 0 1 } clone >self ; : set-initial-color ( -- ) T{ hsva f 0 0 0 1 } clone >self ;

View File

@ -13,16 +13,16 @@ in: springies
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: nodes var: nodes
VAR: springs var: springs
VAR: time-slice var: time-slice
VAR: world-size var: world-size
: world-width ( -- width ) world-size> first ; : world-width ( -- width ) world-size> first ;
: world-height ( -- height ) world-size> second ; : world-height ( -- height ) world-size> second ;
VAR: gravity var: gravity
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! node ! node

View File

@ -29,9 +29,9 @@ in: springies.ui
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
VAR: slate var: slate
VAR: loop var: loop
: update-world-size ( -- ) slate> rect-dim >world-size ; : update-world-size ( -- ) slate> rect-dim >world-size ;