Skip to content

Commit ff38a32

Browse files
committed
Adds '&' as an abbreviation for ADR().
1 parent 78c899f commit ff38a32

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

manual.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,13 +830,15 @@ level" because they interact directly
830830
with the hardware. Use with care!
831831

832832

833-
- ADR(_arr_) :
833+
- ADR(_arr_) / &_arr_ :
834834
Returns the address of the first
835835
element of _arr_ in memory.
836836
Following elements of the array
837837
occupy adjacent memory locations.
838+
Instead of `ADR(X)` you can simply
839+
type `&X`.
838840

839-
- ADR(_str_) :
841+
- ADR(_str_) / &_str_ :
840842
Returns the address of the _string_
841843
in memory. The first memory location
842844
contains the length of the string,

src/basic.syn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ T_EXPR: integer constant, variable or function
224224
"Dpeek" T_EXPR emit TOK_DPEEK
225225
"USR(" EXPR emit TOK_USR_ADDR USR_EXPR_MORE ")" emit TOK_USR_CALL
226226
"ADR(" ADR_EXPR ")"
227+
"&" ADR_EXPR
227228
"Len" STR_PAR_EXPR emit TOK_PEEK # First byte of string is the length
228229
"Val" STR_PAR_EXPR emit TOK_VAL
229230
"ASc" STR_PAR_EXPR emit { TOK_PUSH_1, TOK_ADD, TOK_PEEK } # TODO: does not check for empty strings.

0 commit comments

Comments
 (0)