Rough Book

random musings of just another computer nerd

bAdkOde

Unary-operator statements

There are five unary operators: ) or push, ( or pull, or print value, or print character representation of value, and ? or input.

) or push

Usage:
) [src]

The push operator takes the value supplied and pushes it onto the stack. The source parameter can be a number, register, or memory location.

Examples:
# push 0 onto the stack
)0

# push the value in register a onto the stack
)a

# push the value in the memory location that a
# points to, onto the stack
)[a

( or pull

Usage:
( [src]

The pull operator pulls a value off the stack and stores it in the source parameter. The source parameter can either be a register or a memory location.

Examples:
# pull a value off the top of the stack and store it in register a
(a

# pull a value off the top of the stack and store it in the
# location pointed to by register b
([b

' or print value

Usage:
' [src]

The print value operator prints out the value supplied to it. The operand can be a number, register or memory location.

Examples:
# print the number 10
'10

# print the value in register a
'a

# print the value pointed to, by register b
'[b

" or print character representation of value

The print character representation of value operator takes the source parameter and prints the character representation of the value in the source parameter.

Examples:
# print a space
"32

# print character representation of value in register a
"a

# print character representation of value pointed to by register b
"[b

? or input

Usage:
? [dest]

The input operator accepts a character of input from the user and stores it in the location specified by the destination parameter. For example, if the user entered a space, the number “32″ would be stored.

Examples:
# accept a character of input and store the ASCII value of that character
# in register a
?a

# accept a character of input and store the ASCII value of that character
# in the memory location that register b points to
?[b

Popularity: unranked [?]

Pages: 1 2 3 4 5 6

4 Comments »

  1. Ugh. Macros are the devil incarnate. Nothing makes grep-ing through large amounts of source code more painful than macros. Nice post though. I’m impressed with your use of EBNF and creative ability with new programming languages! This also lead me to look up several other esoteric languages (i.e. Brainfuck).

    Steve

    ReplyReply

    Comment by Steve O | December 14, 2009

  2. @Steve O
    Oh yeah, a large number of macros can make things really hairy. But I think that’s probably due to macro abuse! I made macros here just because that’s what I was familiar with when I was doing assembly programming. Then again, this isn’t meant to be a language for serious software projects! I’m glad you liked the EBNF and I’m also glad that you found bAdkOde creative. I guess all those theoretical computer-science classes I took at ASU weren’t for nothing! ;) Haha!

    Esoteric programming languages are pretty neat. I think you realize how much you take for granted in high-level languages when you work with some of the more limited ones, like Brainfuck. On the other hand, they really make you think in novel ways and also completely change the way you approach problems. I think it’s a good thing.

    ReplyReply

    Comment by vivin | December 14, 2009

  3. [...] bAdkOde [...]

    Pingback by A bAdkOde quine (which proves that bAdkOde is Turing Complete) | Rough Book | December 25, 2009

  4. [...] bAdkOde [...]

    Pingback by A brainfuck interpreter in bAdkOde | Rough Book | January 28, 2010


Leave a Comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
All original content on these pages is fingerprinted and certified by Digiprove