I first had the idea for a language based on program flow through a two-dimensional array of characters in the late 1970s. I vaguely recall reading a magazine article about a real-time microcomputer game in which the user had to navigate the cursor to hit a target. The cursor would continuously move in a straight line unless it encountered a character, and the character might deflect the cursor in various directions or cause other actions. The user could press a key, which would deposit the corresponding character at the current location and immediately "execute" that character's function.
Once the cursor hit the target, the user would get some points, the target would disappear, and a new target would appear elsewhere. Over time the game became more difficult because the screen would fill up with various characters.
I don't recall the name of the game, the computer it ran on, or the magazine which contained the article. If anyone remebers it, please let me know.
In any case, it occurred to me that the same concept could apply to a programming language. In addition to characters that changed the program flow, there would be characters that performed arithmetic and I/O operations. Instead of the user creating the program on the fly, it would be supplied as text file input to the interpreter.
Only recently did I decide to write a language specification and an actual implementation.
Very early draft: language.txt
Hello world:
L0: "Hello world." t n :L
Print a palindrome:
L0: ( n t ( "ABLE WAS I E" ) t "R" t ) |
Subroutine example. Subroutine 37 addes one to TOS. Main program (subroutine 0) calls sub 37 with an arg of 32, and prints result.
L0: ) 32 37 S "Result is: " t t n ) |
3
7
:
\ ) 1 a ) |
Now that I've started documenting and implementing Bouncy, I've discovered that other people have had the same idea at least as early as 1993, when Chris Pressey created the language Befunge.
As compared to Befunge, Bouncy was actually intended to be fairly easy to use. Bouncy allows for numeric constants to be represent as sequences of digits, and similarly supports multicharacter strings as a basic data type (vs. as individual numeric values for each character). Bouncy also provides subroutine calls. In order to provide these features, Bouncy's program stated includes not just the X and Y coordinates of the current program location and the direction of flow, but also a "state". The interpretation of characters varies depending on the state.
|
Last updated December 4, 2005 Copyright 2005 Eric Smith |
|
|