Red Koopa Pathetic excuse for a hacker
Level: 28
Posts: 23/132
EXP: 120237
Next: 11101
Since: 02-19-07
Last post: 6233 days
Last view: 6232 days
|
Copied from my notes:
esoteric programming language outline (created 2/23/07)
data is a bunch of cells arranged in a grid
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
operators:
+ addition
- subtraction
* multiplication
/ division
% modulo
| OR
& AND
~ NOT (possibly !)
# XOR (^ not used for a reason)
$ bitshift (look at it like an 'S')
? if (next instruction carried out if cell value is not 0)
@ move (copies cell value)
ideas for more: power, and other math
each operator can be supplied a direction, which specifies where to get the second argument. the
result is stored in the current cell. if not supplied a direction (maybe if doubled), it performs
a special operation on the cell. doubling a direction character will move the current cell location
in that direction. also statements like +>> are legal, it would add and then move in that direction
(aptly named shortcuts). @ is sort of tricky, instead of getting the second operand from a certian
direction, it copies data in that direction.
directions (mostly obvious):
< left
> right
^ up
v down (lowercase v, although maybe allow uppercase)
. none (use same cell for both operands)
special functions:
+ increment
- decrement
* square
/ squareroot
% ?
| ?
& ?
~ ?
# ?
$ ?
? random
@ ?
general ideas
grid size is defined (can be definite, or infinite), as is cell data type
if definite and moved out of bounds it loops around
execution starts in top left (could be specified, but with looping grid, doesn't need to be)
possibly, abstract shaped grids could be advantageous, so coding is two stages (grid design, code)
actual loops in the code aren't necessary, because of looping grids
language is turing complete (?)
what's really cool is that you can make modular grids, and therefore even huge projects with this!
one possible extension of the language: 3d grids! (would need z-direction operators, but that's
about it!)
standard data type is byte, output and input is ascii (newlines 10), language inspired by BF
all other characters in code are considered comments
also, characters in any kind of bracket, paranthesis, etc., and in C-style comments (/* */ and //)
are all considered comments too, so no mistaken v's in comments
for actually doing useful things, define certain groups of cells as input/output
eg. screen or text output, text or mouse input (omg cool!)
input/output can be combined, input on read, output on write
note sure if directions (for getting operand should be switched, ie. +< would add coming from the
right. it does seem a little intuitive, example is not like this)
language name ideas (based on features like cells and grids, sometimes pun-y)
gridlock
microbe
interpreter ideas:
parse code using regular expressions:
replace(/[^+-*/%|&~#$?<>^v]*/g,''); //remove comments (javascript example)
figure out how grids are stored: (for abstract grids)
simple colored image: white=cell, black/image bounds=no cell (loop), blue=row extends infinitely
define input/output somehow
example program (hello world):
commented:
+++.@> (set 4, store in next cell)
+.@v (h)
>>@>+@v (move, copy 4, output e)
>>@>-*>@v@v (copies, decrements, multiplies by copy to make twelve, outputs two ls)
>>@>+<-@v (o)
+>+>+>@v (space)
->@v (w)
->->@v (o)
+>-@v (r)
<<@v (l)
<<-@v (d)
uncommented:
+++.@>+.@v>>@>+@v>>@>-*>@v@v>>@>+<-@v+>+>+>@v->@v->->@v+>-@v<<@v<<-@v
grid:
[][][][][]
[][][][][] (output, a=1, b=2,...space=27 just for simplicity/not figuring everything out yet)
Anyone want to try coding something? (And yes, this was inspired by BrainFuck, and someone posting about it in another thread inspired me to post this.) |