From fe234b5259402752859382bce01834758f2fab34 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Sun, 3 Jan 2021 09:36:41 +0900 Subject: [PATCH] rename 'string' to 'litstring' --- README.md | 68 ++++++++++++++++++++++++++-------------------------- bootstrap.fs | 4 ++-- planck.xxd | 2 +- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index e5082c1..51c51c0 100644 --- a/README.md +++ b/README.md @@ -33,37 +33,37 @@ bye # Builtin Words -| code | name | stack effect | semantics | -|:----:|:---------|:----------------|:-----------------------------| -| Q | quit | ( -- ) | Exit the process | -| C | cell | ( -- n ) | The size of Cells | -| h | &here | ( -- a-addr ) | The address of 'here' cell | -| l | &latest | ( -- a-addr ) | The address of 'latest' cell | -| k | key | ( -- c ) | Read character | -| t | type | ( c -- ) | Print character | -| j | jump | ( -- ) | Unconditional branch | -| J | 0jump | ( n -- ) | Jump if a == 0 | -| f | find | ( c -- xt ) | Get execution token of c | -| x | execute | ( xt -- ... ) | Run the execution token | -| @ | fetch | ( a-addr -- w ) | Load value from addr | -| ! | store | ( w a-addr -- ) | Store value to addr | -| ? | cfetch | ( c-addr -- c ) | Load byte from addr | -| $ | cstore | ( c c-addr -- ) | Store byte to addr | -| d | dfetch | ( -- a-addr ) | Get data stack pointer | -| D | dstore | ( a-addr -- ) | Set data stack pointer | -| r | rfetch | ( -- a-addr ) | Get return stack pointer | -| R | rstore | ( a-addr -- ) | Set return stack pointer | -| i | docol | ( -- a-addr ) | Get the interpreter function | -| e | exit | ( -- ) | Exit current function | -| L | lit | ( -- n ) | Load immediate | -| S | string | ( -- c-addr u ) | Load string literal | -| + | add | ( a b -- c ) | c = (a + b) | -| - | sub | ( a b -- c ) | c = (a - b) | -| * | mul | ( a b -- c ) | c = (a * b) | -| / | div | ( a b -- c ) | c = (a / b) | -| % | mod | ( a b -- c ) | c = (a % b) | -| & | and | ( a b -- c ) | c = (a & b) | -| \| | or | ( a b -- c ) | c = (a \| b) | -| ^ | xor | ( a b -- c ) | c = (a ^ b) | -| < | less | ( a b -- c ) | c = (a < b) | -| = | equal | ( a b -- c ) | c = (a == b) | +| code | name | stack effect | semantics | +|:----:|:----------|:----------------|:-----------------------------| +| Q | quit | ( -- ) | Exit the process | +| C | cell | ( -- n ) | The size of Cells | +| h | &here | ( -- a-addr ) | The address of 'here' cell | +| l | &latest | ( -- a-addr ) | The address of 'latest' cell | +| k | key | ( -- c ) | Read character | +| t | type | ( c -- ) | Print character | +| j | jump | ( -- ) | Unconditional branch | +| J | 0jump | ( n -- ) | Jump if a == 0 | +| f | find | ( c -- xt ) | Get execution token of c | +| x | execute | ( xt -- ... ) | Run the execution token | +| @ | fetch | ( a-addr -- w ) | Load value from addr | +| ! | store | ( w a-addr -- ) | Store value to addr | +| ? | cfetch | ( c-addr -- c ) | Load byte from addr | +| $ | cstore | ( c c-addr -- ) | Store byte to addr | +| d | dfetch | ( -- a-addr ) | Get data stack pointer | +| D | dstore | ( a-addr -- ) | Set data stack pointer | +| r | rfetch | ( -- a-addr ) | Get return stack pointer | +| R | rstore | ( a-addr -- ) | Set return stack pointer | +| i | docol | ( -- a-addr ) | Get the interpreter function | +| e | exit | ( -- ) | Exit current function | +| L | lit | ( -- n ) | Load immediate | +| S | litstring | ( -- c-addr u ) | Load string literal | +| + | add | ( a b -- c ) | c = (a + b) | +| - | sub | ( a b -- c ) | c = (a - b) | +| * | mul | ( a b -- c ) | c = (a * b) | +| / | div | ( a b -- c ) | c = (a / b) | +| % | mod | ( a b -- c ) | c = (a % b) | +| & | and | ( a b -- c ) | c = (a & b) | +| \| | or | ( a b -- c ) | c = (a \| b) | +| ^ | xor | ( a b -- c ) | c = (a ^ b) | +| < | less | ( a b -- c ) | c = (a < b) | +| = | equal | ( a b -- c ) | c = (a == b) | diff --git a/bootstrap.fs b/bootstrap.fs index b92a25b..2f463cd 100644 --- a/bootstrap.fs +++ b/bootstrap.fs @@ -442,7 +442,7 @@ alias-builtin rp! R alias-builtin docol i alias-builtin exit e alias-builtin lit L -alias-builtin string S +alias-builtin litstring S alias-builtin div / alias-builtin mod % alias-builtin and & @@ -1128,7 +1128,7 @@ char 0 char B - constant string-overflow-error \ -18 \ immediate mode: the string is stored to temporary buffer. : s" state @ if - compile string + compile litstring here 0 , \ save location of length and fill dummy 0 \ length of the string begin key dup '"' <> while diff --git a/planck.xxd b/planck.xxd index db38787..b60ec97 100644 --- a/planck.xxd +++ b/planck.xxd @@ -105,7 +105,7 @@ 00000298: 9c82 0408 ad50 adff lodsl; pushl %eax; next; 000002a0: 2000 0000 0000 0000 -000002a8: 9082 0408 0153 0000 S: string +000002a8: 9082 0408 0153 0000 S: litstring 000002b0: b482 0408 ad56 5001 lodsl; pushl %esi; pushl %eax 000002b8: c683 c603 83e6 fcad addl %eax,%esi; addl $3,%esi; andl $~3,%esi;next; 000002c0: ff20 0000 0000 0000