Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- number (sequence of digits 0-9, ~ prefix for negatives)
- " toggle string mode:
- on: push 0,
- off: push string in reverse order
- + add
- - subtract
- * multiply
- / integer division
- % mod
- : duplicate top of stack
- \ swap top 2
- ! logical not
- @ push line number
- & go to line
- A-F write to variable
- a-f read
- 'skip the rest of the line (comment)
- # sleep
- ? print number
- $ pop and print CHR$ until it reaches 0
- _ skip if 0 (originally was if NOT 0, but I never ended up using this)
- | go down number of lines
- ^ go up number of lines (obsolete and dumb, but I just can't remove it. it was literally the first command I thought of)
- unused symbols:
- G-Z,g-z (may be used for more variables or accessing other stuff) (should not be assigned randomly (yet(?)), like p and g in befunge)
- ` (no one likes this symbol :P)
- ()[]{} may be used for some kind of loop or something. but that seems like too much structure for me, so...
- = might be used to check if 2 vars are equal, but you could always do -! so that seems wasteful...
- < > again, could be used for greater than or less than, this is more likely but I might consider using them to jump within a line (though I want this language to be heavily line-oriented so I really shouldn't add that)
- ,. ugh these are so small and uncentered. additionally, if I wanted to allow real numbers, I would want . to be available. and , idk who cares
- ; I'm using this for debug, that might be what is stays at. however, I might consider using it to duplicate the 2nd value, either like:
- 1,2,3 -> 1,2,2,3 or 1,2,3 -> 1,2,3,2 this seems oddly specific but I feel like it's something that I've wanted.
- --now I must get this out of the way... IDK if this langugage is turing complete, I suspect maybe not. and I'm sure someone would LOVE to RUIN the language, like what happened with befunge-98
- so please, suggest things to me, don't try to make it on your own--
- whitespace:
- new lines are important and must be preserved. as well as CONSECUTIVE new lines
- OH! I'll use , as a new line substitute, so that if you are posting programs on a terrible site that doesn't allow new lines, then you can use commas.
- spaces are also important.
- consider this:
- 10 6
- this pushes 10 and 6, but if spaces are removed, it's suddenly 106. (BAD)
- tabs should be treated the same way (I discourage their use because of inconsistant support, however)
- so the new commands I am considering are:
- ; pop a, pop b, push b, push b, push a
- , same use as a new line (note: reccommended to be converted when saving/loading, or before execution, as the interpreter is line based)
- . reserved (for decimal point)
- ` end program (reasoning: this symbol is disgusting)
- ok so here's a program to get the fibonnaci sequence:
- 1
- @A
- a&
- Uses a stack that starts out with infinite 0s (this can of course be emulated by making POP return 0 when stack is "empty")
- LITERALS:
- " toggle string mode:
- on start: push 0
- during: push each character onto a temporary string variable
- on end: push ascii values of all characters on string, from end to start.
- sequence of digits, ~ prefix for negatives: Push the number to the stack
- ' comment: (skip rest of current line)
- OUTPUT:
- $ string output: pop, print character, repeat until popped value is 0.
- ? number output: pop value and print.
- INPUT:
- # sleep: wait until button/key is pressed
- CALCULATION:
- + add: pop two values, push the sum
- - subtract: pop a,b push b-a
- * multiply: pop two values, push the product
- / integer division: pop a,b push b/a, rounded towards 0 (integer division (DIV in some languages))
- % mod: pop a,b push b mod a.
- ! logical not: pop a value, and push 1 if the value is 0, and 0 otherwise
- STACK:
- : duplicate top value
- ; duplicate 2nd value (equivilant to ABbba)
- \ swap top two values
- MOVEMENT:
- @ push line number
- & pop number, jump to that line. if negative, add the program length (so you can jump to -1 to end the program)
- ^ pop number, go up that many lines. if 0, restart current line
- _ pop number, if 0 then skip next line
- | pop number, jump down that many lines
- VARIABLES:
- A-F store value
- a-f read value
- RESERVED:
- , substitiute for line break
- . reserved for possible real numbers
- UNUSED:
- =
- `
- ()
- {}
- []
- <> possibly
- ( = skip unless line was jumped to by ^ _ or |
- ) = ayy lmao
- {} = just loop forever goddammit
- [] = stop adding so many fucking brackets, ok?
- <> = lol input XD
- but really, how about macros?
- G-Z or something, will be definable
- so like
- G'rest of line is now the macro
- and called using g
- ugh but then we still has no uses for the braaaaaaackets
- ok ok really now
- () will be some controlled line skip thing, to make switch case thingys easier, for example.
- {} will be loop forever, and then you can use _ to break out of it if you want.
- [] will be a block comment, anything inside is ignored.
- { = push LINE number (yes you heard me) to stack 2,
- } = pop from stack 2 and goto that line
- ( = skip unless line was jumped to
- ) = ???
- G-Z = define rest of line as a macro (implications PLZ)
- g-z = execute macro. spacing and new lines are preserved. so keep that in mind. (of course macros can't have nls since they are by definition a single line)
- ) = execute once (applies to entire line. should be used at the start. the line WILL still take up space in the program. perhaps you can simply just set the variable holding that line's code to "".
- ` = greater than (maybe)
- = = get inkey$. perhaps for useage after a #? yeah I wanted this one to be the ONLY way to input because it's the only thing left xd
- input value (sorry I'm really running out of symbols to use). if it's a number (regex: -?\d+) then push number, else push like a string lmao
- [ = ignore code until next ]
- ] = end BLOCK comment (not normal comment though)
- OH I KNOW!!!
- change:
- < > = greater / less (wow wasteful IK)
- = is input number
- ` is input string
- problems is solve.
- WwwwWWwwWWwwrrr
- a few notes: division and mod by 0 will return 0, since crashes are baad.
- using } when nothing is on the stack results in no movement.
- ] when not in a block comment does nothing
- ` should use the normal string input, where you type in characters and press enter to submit
- = is the same, but must only allow numbers.
- program execution only stops when reaching the end of the program.
- you can do this using ~1& which jumps to the last line (always empty)
- if you have any questions please ask me, I might have forgotten to explain something.
- variables are all signed integers, something like 32 bit is the normal, but not required.
- variables are signed 32 bit integers
- when popping an empty stack, return 0
- division and mod by 0 will return 0
- { push line number to stack 2
- } pop line number from stack 2 and go to that line
- To be used at the beginning of lines only
- ( rest of skip line, unless the line was jumped to by ^ _ | or &
- ) delete line after execution
- G-Z rest of line is saved to that variable (macros)
- g-z execute corresponding macro (as if the letter was replaced by the code)
- [ skip code until you reach the next ]
- instructions sorted by ascii code:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement