Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- symbols
- -------
- print: Pop a Token, print to standard out
- pop: pop a Token, throw it away
- dup: copy Token on top
- flip: switch the positions of the top two Tokens
- wrap: put the top Token into a List
- error if already List
- unwrap: if a List is top Token
- -put all List members onto Stack, remove list
- -ex: if Stack is { 123 456 } Stack becomes 123 456
- yank: if a List is the top Token
- -take the last Token in said List
- -put on top of Stack
- otherwise error
- shove: if a List is the second-to-top Token,
- and something that ISN'T a List is the top
- -pop Token
- -put at end of List below
- otherwise error
- tie: If top Token is a List of all Strings,
- -concat all List members into one long string
- -remove List, push new String
- untie: if top Token is String,
- -convert to List containing each character of String as individual Strings
- -ex: if Stack is "ABCDE" Stack becomes { "A" "B" "C" "D" "E" }
- count: push Integer of number of Tokens in Stack (not counting this one)
- -ex: if Stack is 12 "ayy" then Stack becomes 12 "ayy" 2
- sys-info: push List of way more Interpeter state info than you wanted
- (you asked for this)
- length: push Integer of number of Tokens in List at top of Stack
- -if not List do error for bad day
- quit: forcibly exit Custom Symbol/List Execute
- -if not in then die
- end: forcibly exit Interpreter/program
- -works anywhere!
- define: define a Custom Symbol
- -first pops a String telling Symbol name
- -next pops a Token
- -if Token is List, Symbol becomes an instruction
- -when called, List contents are executed as if a program
- -ex: { 1 add } "plus-one" define 1 plus-one print end
- -prints 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement