so simple dollar
Jump to navigation
Jump to search
so simple dollar is among the simplest programming languages. It only uses $ but the amount of the symbol determines the command.
Architecture
The program memory, resembles brainfuck's model, being defined as a composition of an infinite tally of cells, each storing a single signed integer of unbounded magnitude. Starting at the incipient member, a cell pointer marks at any instant the current active cell, amenable to queries and modifications.
Syntax
The following Extended Backus-Naur Form description (EBNF) applies to the so simple dollar programming language:
program := whitespaces
, startProgram
, sepiment
, { statement , sepiment }
, endProgram
, whitespaces
;
statement := printBlock
| takeInput
| storeInput
| moveLeft
| moveRight
;
startProgram := "$" ;
endProgram := "$$" ;
printBlock := startPrint , { printCommand } , endPrint ;
startPrint := "$$$" ;
endPrint := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
printCommand := printLetterA
| printLetterB
| printLetterC
| printLetterD
| printLetterE
| printLetterF
| printLetterG
| printLetterH
| printLetterI
| printLetterJ
| printLetterK
| printLetterL
| printLetterM
| printLetterN
| printLetterO
| printLetterP
| printLetterQ
| printLetterR
| printLetterS
| printLetterT
| printLetterU
| printLetterV
| printLetterW
| printLetterX
| printLetterY
| printLetterZ
| printCell
;
printLetterA := "$$$$" ;
printLetterB := "$$$$$" ;
printLetterC := "$$$$$$" ;
printLetterD := "$$$$$$$" ;
printLetterE := "$$$$$$$$" ;
printLetterF := "$$$$$$$$$" ;
printLetterG := "$$$$$$$$$$" ;
printLetterH := "$$$$$$$$$$$" ;
printLetterI := "$$$$$$$$$$$$" ;
printLetterJ := "$$$$$$$$$$$$$" ;
printLetterK := "$$$$$$$$$$$$$$" ;
printLetterL := "$$$$$$$$$$$$$$$" ;
printLetterM := "$$$$$$$$$$$$$$$$" ;
printLetterN := "$$$$$$$$$$$$$$$$$" ;
printLetterO := "$$$$$$$$$$$$$$$$$$" ;
printLetterP := "$$$$$$$$$$$$$$$$$$$" ;
printLetterQ := "$$$$$$$$$$$$$$$$$$$$" ;
printLetterR := "$$$$$$$$$$$$$$$$$$$$$" ;
printLetterS := "$$$$$$$$$$$$$$$$$$$$$$" ;
printLetterT := "$$$$$$$$$$$$$$$$$$$$$$$" ;
printLetterU := "$$$$$$$$$$$$$$$$$$$$$$$$" ;
printLetterV := "$$$$$$$$$$$$$$$$$$$$$$$$$" ;
printLetterW := "$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
printLetterX := "$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
printLetterY := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
printLetterZ := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
printCell := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
takeInput := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
storeInput := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
moveRight := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
moveLeft := "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" ;
sepiment := whitespace , whitspaces ;
whitespaces := { whitespace } ;
whitespace := " " | "\t" | "\n" ;
Commands
| Command | Description |
|---|---|
$
|
Begin the program. |
$$
|
End the program. |
$$$
|
Begin printing a message. |
$$$$
|
Print a letter (add one $ to indicate the letter; e.g.: $$$$$ = b).
|
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
End the printing. |
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
Take a user input. |
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
Store the user input to a memory cell (like brainfuck). |
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
Switch to the right cell. |
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
Switch to the left cell. |
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
Print the character associated with the current cell's value (like brainfuck). |
Examples
Hello, world!
This program outputs the text "helloworld":
$ $$$ $$$$$$$$$$$ $$$$$$$$ $$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$ $$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$
Cat program
A one-time cat program is implemented below:
$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$
Interpreter
- Common Lisp implementation of the so simple dollar programming language.