mirror of
https://github.com/nineties/planckforth
synced 2024-12-25 21:58:22 +01:00
Add "v" to python-implementation
This commit is contained in:
parent
2318cbf711
commit
f29471fb7c
1 changed files with 14 additions and 0 deletions
|
@ -119,6 +119,16 @@ def add_binary_operator(name, op):
|
|||
write(HERE_CELL, 2*CELL)
|
||||
write(LATEST_CELL, 0)
|
||||
|
||||
# Store command line arguments
|
||||
argv_addrs = []
|
||||
for arg in sys.argv:
|
||||
argv_addrs.append(read(HERE_CELL))
|
||||
comma_string(arg)
|
||||
align()
|
||||
ARGV_ADDR = read(HERE_CELL)
|
||||
for addr in argv_addrs:
|
||||
comma(addr)
|
||||
|
||||
def docol(ip, np):
|
||||
rpush(np)
|
||||
return next(ip + CELL)
|
||||
|
@ -170,6 +180,10 @@ add_binary_operator('|', operator.or_)
|
|||
add_binary_operator('^', operator.xor)
|
||||
add_binary_operator('<', operator.lt)
|
||||
add_binary_operator('=', operator.eq)
|
||||
def argv():
|
||||
push(ARGV_ADDR)
|
||||
push(len(sys.argv))
|
||||
add_simple_operator('v', argv)
|
||||
|
||||
start = read(HERE_CELL)
|
||||
comma(find('k'))
|
||||
|
|
Loading…
Reference in a new issue