factor: more syntax work.
parent
dfc87db5df
commit
d5bc631401
|
@ -42,12 +42,12 @@ HELP: run-dataflow-analysis
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
HELP: FORWARD-ANALYSIS:
|
HELP: forward-analysis:
|
||||||
{ $syntax "FORWARD-ANALYSIS: word" }
|
{ $syntax "forward-analysis: word" }
|
||||||
{ $values { "word" "name of the compiler pass" } }
|
{ $values { "word" "name of the compiler pass" } }
|
||||||
{ $description "Syntax word for defining a forward analysis compiler pass." } ;
|
{ $description "Syntax word for defining a forward analysis compiler pass." } ;
|
||||||
|
|
||||||
HELP: BACKWARD-ANALYSIS:
|
HELP: backward-analysis:
|
||||||
{ $syntax "BACKWARD-ANALYSIS: word" }
|
{ $syntax "backward-analysis: word" }
|
||||||
{ $values { "word" "name of the compiler pass" } }
|
{ $values { "word" "name of the compiler pass" } }
|
||||||
{ $description "Syntax word for defining a backward analysis compiler pass." } ;
|
{ $description "Syntax word for defining a backward analysis compiler pass." } ;
|
||||||
|
|
|
@ -133,8 +133,8 @@ INSTANCE: name backward-analysis ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
SYNTAX: FORWARD-ANALYSIS:
|
SYNTAX: forward-analysis:
|
||||||
scan-token [ define-analysis ] [ define-forward-analysis ] bi ;
|
scan-token [ define-analysis ] [ define-forward-analysis ] bi ;
|
||||||
|
|
||||||
SYNTAX: BACKWARD-ANALYSIS:
|
SYNTAX: backward-analysis:
|
||||||
scan-token [ define-analysis ] [ define-backward-analysis ] bi ;
|
scan-token [ define-analysis ] [ define-backward-analysis ] bi ;
|
||||||
|
|
|
@ -17,7 +17,7 @@ in: compiler.cfg.gvn.avail
|
||||||
! This doesn't propagate across "kill blocks". Not sure if
|
! This doesn't propagate across "kill blocks". Not sure if
|
||||||
! that's right, though I may as well assume as much.
|
! that's right, though I may as well assume as much.
|
||||||
|
|
||||||
FORWARD-ANALYSIS: avail
|
forward-analysis: avail
|
||||||
|
|
||||||
M: avail transfer-set drop defined assoc-union ;
|
M: avail transfer-set drop defined assoc-union ;
|
||||||
|
|
||||||
|
|
|
@ -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! ;
|
||||||
|
|
|
@ -15,29 +15,29 @@ in: compiler.cfg.stacks.global
|
||||||
: transfer-peeked-locs ( set bb -- set' )
|
: transfer-peeked-locs ( set bb -- set' )
|
||||||
[ replace-set diff ] [ peek-set union ] bi ;
|
[ replace-set diff ] [ peek-set union ] bi ;
|
||||||
|
|
||||||
BACKWARD-ANALYSIS: anticip
|
backward-analysis: anticip
|
||||||
|
|
||||||
M: anticip transfer-set drop transfer-peeked-locs ;
|
M: anticip transfer-set drop transfer-peeked-locs ;
|
||||||
M: anticip join-sets 2drop refine ;
|
M: anticip join-sets 2drop refine ;
|
||||||
|
|
||||||
BACKWARD-ANALYSIS: live
|
backward-analysis: live
|
||||||
|
|
||||||
M: live transfer-set drop transfer-peeked-locs ;
|
M: live transfer-set drop transfer-peeked-locs ;
|
||||||
M: live join-sets 2drop combine ;
|
M: live join-sets 2drop combine ;
|
||||||
|
|
||||||
FORWARD-ANALYSIS: avail
|
forward-analysis: avail
|
||||||
|
|
||||||
M: avail transfer-set
|
M: avail transfer-set
|
||||||
drop [ peek-set ] [ replace-set ] bi union union ;
|
drop [ peek-set ] [ replace-set ] bi union union ;
|
||||||
M: avail join-sets 2drop refine ;
|
M: avail join-sets 2drop refine ;
|
||||||
|
|
||||||
FORWARD-ANALYSIS: pending
|
forward-analysis: pending
|
||||||
|
|
||||||
M: pending transfer-set
|
M: pending transfer-set
|
||||||
drop replace-set union ;
|
drop replace-set union ;
|
||||||
M: pending join-sets 2drop refine ;
|
M: pending join-sets 2drop refine ;
|
||||||
|
|
||||||
BACKWARD-ANALYSIS: dead
|
backward-analysis: dead
|
||||||
|
|
||||||
M: dead transfer-set
|
M: dead transfer-set
|
||||||
drop [ kill-set ] [ replace-set ] bi union union ;
|
drop [ kill-set ] [ replace-set ] bi union union ;
|
||||||
|
|
|
@ -77,7 +77,7 @@ M: ##peek visit-insn ( state insn -- state )
|
||||||
M: insn visit-insn ( state insn -- state' )
|
M: insn visit-insn ( state insn -- state' )
|
||||||
drop ;
|
drop ;
|
||||||
|
|
||||||
FORWARD-ANALYSIS: padding
|
forward-analysis: padding
|
||||||
|
|
||||||
symbol: stack-record
|
symbol: stack-record
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ symbol: registers
|
||||||
|
|
||||||
V{ } registers set-global
|
V{ } registers set-global
|
||||||
|
|
||||||
SYNTAX: REGISTER:
|
SYNTAX: register:
|
||||||
scan-new-word
|
scan-new-word
|
||||||
[ define-symbol ]
|
[ define-symbol ]
|
||||||
[ registers get length "register" set-word-prop ]
|
[ registers get length "register" set-word-prop ]
|
||||||
|
@ -20,22 +20,22 @@ SYNTAX: REGISTER:
|
||||||
|
|
||||||
>>
|
>>
|
||||||
|
|
||||||
REGISTER: R0
|
register: R0
|
||||||
REGISTER: R1
|
register: R1
|
||||||
REGISTER: R2
|
register: R2
|
||||||
REGISTER: R3
|
register: R3
|
||||||
REGISTER: R4
|
register: R4
|
||||||
REGISTER: R5
|
register: R5
|
||||||
REGISTER: R6
|
register: R6
|
||||||
REGISTER: R7
|
register: R7
|
||||||
REGISTER: R8
|
register: R8
|
||||||
REGISTER: R9
|
register: R9
|
||||||
REGISTER: R10
|
register: R10
|
||||||
REGISTER: R11
|
register: R11
|
||||||
REGISTER: R12
|
register: R12
|
||||||
REGISTER: R13
|
register: R13
|
||||||
REGISTER: R14
|
register: R14
|
||||||
REGISTER: R15
|
register: R15
|
||||||
|
|
||||||
ALIAS: SL R10 ; ALIAS: FP R11 ; ALIAS: IP R12 ;
|
ALIAS: SL R10 ; ALIAS: FP R11 ; ALIAS: IP R12 ;
|
||||||
ALIAS: SP R13 ; ALIAS: LR R14 ; ALIAS: PC R15 ;
|
ALIAS: SP R13 ; ALIAS: LR R14 ; ALIAS: PC R15 ;
|
||||||
|
|
|
@ -34,7 +34,7 @@ CONSTANT: seh-names
|
||||||
{ $ STATUS_FLOAT_MULTIPLE_FAULTS "STATUS_FLOAT_MULTIPLE_FAULTS" }
|
{ $ STATUS_FLOAT_MULTIPLE_FAULTS "STATUS_FLOAT_MULTIPLE_FAULTS" }
|
||||||
{ $ STATUS_FLOAT_MULTIPLE_TRAPS "STATUS_FLOAT_MULTIPLE_TRAPS" }
|
{ $ STATUS_FLOAT_MULTIPLE_TRAPS "STATUS_FLOAT_MULTIPLE_TRAPS" }
|
||||||
{ 0xe06d7363 "Visual C++ exception" }
|
{ 0xe06d7363 "Visual C++ exception" }
|
||||||
}
|
} ;
|
||||||
|
|
||||||
: seh-name. ( n -- )
|
: seh-name. ( n -- )
|
||||||
seh-names at [ " (" ")" surround write ] when* ;
|
seh-names at [ " (" ")" surround write ] when* ;
|
||||||
|
|
|
@ -24,20 +24,20 @@ icons [ H{ } clone ] initialize
|
||||||
define
|
define
|
||||||
] 2bi ;
|
] 2bi ;
|
||||||
|
|
||||||
SYNTAX: ICON: scan-word scan-token define-icon ;
|
SYNTAX: ICON: scan-word scan-token ";" expect define-icon ;
|
||||||
|
|
||||||
>>
|
>>
|
||||||
|
|
||||||
ICON: predicate-class class-predicate-word
|
ICON: predicate-class class-predicate-word ;
|
||||||
ICON: generic generic-word
|
ICON: generic generic-word ;
|
||||||
ICON: macro macro-word
|
ICON: macro macro-word ;
|
||||||
ICON: parsing-word parsing-word
|
ICON: parsing-word parsing-word ;
|
||||||
ICON: primitive primitive-word
|
ICON: primitive primitive-word ;
|
||||||
ICON: symbol symbol-word
|
ICON: symbol symbol-word ;
|
||||||
ICON: constant constant-word
|
ICON: constant constant-word ;
|
||||||
ICON: word normal-word
|
ICON: word normal-word ;
|
||||||
ICON: word-link word-help-article
|
ICON: word-link word-help-article ;
|
||||||
ICON: topic help-article
|
ICON: topic help-article ;
|
||||||
ICON: runnable-vocab runnable-vocab
|
ICON: runnable-vocab runnable-vocab ;
|
||||||
ICON: vocab open-vocab
|
ICON: vocab open-vocab ;
|
||||||
ICON: vocab-link unopen-vocab
|
ICON: vocab-link unopen-vocab ;
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
USING: io.encodings.iana io.encodings.euc ;
|
USING: io.encodings.iana io.encodings.euc ;
|
||||||
in: io.encodings.big5
|
in: io.encodings.big5
|
||||||
|
|
||||||
EUC: big5 "vocab:io/encodings/big5/CP950.TXT"
|
EUC: big5 "vocab:io/encodings/big5/CP950.TXT" ;
|
||||||
|
|
||||||
big5 "Big5" register-encoding
|
big5 "Big5" register-encoding
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
USING: io.encodings.euc io.encodings.iana ;
|
USING: io.encodings.euc io.encodings.iana ;
|
||||||
in: io.encodings.euc-jp
|
in: io.encodings.euc-jp
|
||||||
|
|
||||||
EUC: euc-jp "vocab:io/encodings/euc-jp/euc-jp-2000-std.txt"
|
EUC: euc-jp "vocab:io/encodings/euc-jp/euc-jp-2000-std.txt" ;
|
||||||
|
|
||||||
euc-jp "Extended_UNIX_Code_Packed_Format_for_Japanese" register-encoding
|
euc-jp "Extended_UNIX_Code_Packed_Format_for_Japanese" register-encoding
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
USING: io.encodings.iana io.encodings.euc ;
|
USING: io.encodings.iana io.encodings.euc ;
|
||||||
in: io.encodings.euc-kr
|
in: io.encodings.euc-kr
|
||||||
|
|
||||||
EUC: euc-kr "vocab:io/encodings/euc-kr/data/cp949.txt"
|
EUC: euc-kr "vocab:io/encodings/euc-kr/data/cp949.txt" ;
|
||||||
|
|
||||||
euc-kr "EUC-KR" register-encoding
|
euc-kr "EUC-KR" register-encoding
|
||||||
|
|
|
@ -64,5 +64,5 @@ 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 define-euc ;
|
scan-new-class scan-object ";" expect define-euc ;
|
||||||
|
|
|
@ -33,10 +33,10 @@ M: iso2022 <decoder>
|
||||||
|
|
||||||
CONSTANT: ESC 0x16 ;
|
CONSTANT: ESC 0x16 ;
|
||||||
|
|
||||||
CONSTANT: switch-ascii B{ $ ESC char: ( char: B } ;
|
CONSTANT: switch-ascii B{ $ ESC char: \( char: B } ;
|
||||||
CONSTANT: switch-jis201 B{ $ ESC char: ( char: J } ;
|
CONSTANT: switch-jis201 B{ $ ESC char: \( char: J } ;
|
||||||
CONSTANT: switch-jis208 B{ $ ESC char: $ char: B } ;
|
CONSTANT: switch-jis208 B{ $ ESC char: $ char: B } ;
|
||||||
CONSTANT: switch-jis212 B{ $ ESC char: $ char: ( char: D } ;
|
CONSTANT: switch-jis212 B{ $ ESC char: $ char: \( char: D } ;
|
||||||
|
|
||||||
: find-type ( char -- code type )
|
: find-type ( char -- code type )
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ M:: iso2022-state encode-char ( char stream encoding -- )
|
||||||
|
|
||||||
: read-escape ( stream -- type/f )
|
: read-escape ( stream -- type/f )
|
||||||
dup stream-read1 {
|
dup stream-read1 {
|
||||||
{ char: ( [
|
{ char: \( [
|
||||||
stream-read1 {
|
stream-read1 {
|
||||||
{ char: B [ ascii get-global ] }
|
{ char: B [ ascii get-global ] }
|
||||||
{ char: J [ jis201 get-global ] }
|
{ char: J [ jis201 get-global ] }
|
||||||
|
@ -73,7 +73,7 @@ M:: iso2022-state encode-char ( char stream encoding -- )
|
||||||
dup stream-read1 {
|
dup stream-read1 {
|
||||||
{ char: @ [ drop jis208 get-global ] } ! want: JIS X 0208-1978
|
{ char: @ [ drop jis208 get-global ] } ! want: JIS X 0208-1978
|
||||||
{ char: B [ drop jis208 get-global ] }
|
{ char: B [ drop jis208 get-global ] }
|
||||||
{ char: ( [
|
{ char: \( [
|
||||||
stream-read1 char: D = jis212 get-global f ?
|
stream-read1 char: D = jis212 get-global f ?
|
||||||
] }
|
] }
|
||||||
[ 2drop f ]
|
[ 2drop f ]
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
use: io.encodings.euc
|
use: io.encodings.euc
|
||||||
in: io.encodings.johab
|
in: io.encodings.johab
|
||||||
|
|
||||||
EUC: johab "vocab:io/encodings/johab/johab.txt"
|
EUC: johab "vocab:io/encodings/johab/johab.txt" ;
|
||||||
|
|
|
@ -150,7 +150,7 @@ ERROR: not-absolute-path ;
|
||||||
unicode-prefix ?head drop
|
unicode-prefix ?head drop
|
||||||
dup {
|
dup {
|
||||||
[ length 2 >= ]
|
[ length 2 >= ]
|
||||||
[ second char: : = ]
|
[ second char: \: = ]
|
||||||
[ first Letter? ]
|
[ first Letter? ]
|
||||||
} 1&& [ 2 head "\\" append ] [ not-absolute-path ] if ;
|
} 1&& [ 2 head "\\" append ] [ not-absolute-path ] if ;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ CONSTANT: share-mode
|
||||||
FILE_SHARE_READ
|
FILE_SHARE_READ
|
||||||
FILE_SHARE_WRITE
|
FILE_SHARE_WRITE
|
||||||
FILE_SHARE_DELETE
|
FILE_SHARE_DELETE
|
||||||
}
|
} ;
|
||||||
|
|
||||||
: default-security-attributes ( -- obj )
|
: default-security-attributes ( -- obj )
|
||||||
SECURITY_ATTRIBUTES <struct>
|
SECURITY_ATTRIBUTES <struct>
|
||||||
|
@ -332,7 +332,7 @@ M: windows root-directory? ( path -- ? )
|
||||||
{ [ dup empty? ] [ drop f ] }
|
{ [ dup empty? ] [ drop f ] }
|
||||||
{ [ dup [ path-separator? ] all? ] [ drop t ] }
|
{ [ dup [ path-separator? ] all? ] [ drop t ] }
|
||||||
{ [ dup trim-tail-separators { [ length 2 = ]
|
{ [ dup trim-tail-separators { [ length 2 = ]
|
||||||
[ second char: : = ] } 1&& ] [ drop t ] }
|
[ second char: \: = ] } 1&& ] [ drop t ] }
|
||||||
{ [ dup unicode-prefix head? ]
|
{ [ dup unicode-prefix head? ]
|
||||||
[ trim-tail-separators length unicode-prefix length 2 + = ] }
|
[ trim-tail-separators length unicode-prefix length 2 + = ] }
|
||||||
[ drop f ]
|
[ drop f ]
|
||||||
|
|
|
@ -11,9 +11,9 @@ in: parser-combinators.simple
|
||||||
[ digit? ] satisfy <*> [ string>number ] <@ ;
|
[ digit? ] satisfy <*> [ string>number ] <@ ;
|
||||||
|
|
||||||
: string-parser ( -- parser )
|
: string-parser ( -- parser )
|
||||||
[ char: " = ] satisfy
|
[ char: \" = ] satisfy
|
||||||
[ char: " = not ] satisfy <*> &>
|
[ char: \" = not ] satisfy <*> &>
|
||||||
[ char: " = ] satisfy <& [ >string ] <@ ;
|
[ char: \" = ] satisfy <& [ >string ] <@ ;
|
||||||
|
|
||||||
: bold-parser ( -- parser )
|
: bold-parser ( -- parser )
|
||||||
"*" token
|
"*" token
|
||||||
|
|
|
@ -74,9 +74,9 @@ PRIVATE>
|
||||||
|
|
||||||
: string-parser ( -- parser )
|
: string-parser ( -- parser )
|
||||||
[
|
[
|
||||||
[ char: " = ] satisfy hide ,
|
[ char: \" = ] satisfy hide ,
|
||||||
[ char: " = not ] satisfy repeat0 ,
|
[ char: \" = not ] satisfy repeat0 ,
|
||||||
[ char: " = ] satisfy hide ,
|
[ char: \" = ] satisfy hide ,
|
||||||
] seq* [ first >string ] action ;
|
] seq* [ first >string ] action ;
|
||||||
|
|
||||||
: (range-pattern) ( pattern -- string )
|
: (range-pattern) ( pattern -- string )
|
||||||
|
|
Loading…
Reference in New Issue