Thursday, October 1, 2015

What's up? Esoteric! - Cerveau Choix


OK, so I've been really into Esoteric languages. Y'know, those languages that aren't really practical to do real-world-ish stuff in, but are fun to program in. I'm also working on a few (yes, a few!) of my own. I'm not sure which one will be finished first... *OCD FTW*

All notes on these programming schematics are from my notes.

Cerveau Choix

For convenience,there are alternate names by which the language may be named:
  • Cerveau Choix (Pronounced “Sare-voh Schwa”)
  • Cerveau (Pronounced “Sare-voh”)
  • CC (Pronounced “Sea-sea”)
  • Choix (Pronounced “Schwa”)
  • English “Brain Choice”
This is really just a fancy skin for BF (with some extra bonuses), allowing one to golf with certain characters. The concept is that each of the BF characters are mapped to a number, like so:
  1. <
  2. >
  3. +
  4. -
  5. [
  6. ]
  7. ,
  8. .

And then mapping permutations of characters to those symbols.
Outline:
Every program consists of a preamble, consisting of the following:
C1CnD
Where all i, j, CiCj and CiD, also with Ci denoting some arbitrary character. After the preamble follows the code, either on the following lines or on the same line, where a “\n” precedes the code (symbolic of newline). For example, a BF code might be thus:
++++++++[>++++++++<-].
Might print out character 64. Let's say our preamble was thus:
AB.
Then, our dictionary would be this:
<
A
>
B
+
AA
    •  
AB
[
BA
]
BB
,
AAA
.
AAB
And so, the code would be translated as thus:
AB.
AA.AA.AA.AA.AA.AA.AA.AA.BA.B.AA.AA.AA.AA.AA.AA.AA.AA.A.AB.BB.AAB
As one can tell, the trailing delineator is not required.
One is not limited to two symbols in the preamble; one can you anywhere from 1 to 8 (more than 8 is allowed, but is impractical.) Examples of preambles and the respective code and chart:
eFg~!
<
>
+
    •  
[
]
,
.
e
F
g
~
ee
eF
eg
e~
eFg~!
g!g!g!g!g!g!g!g!ee!F!g!g!g!g!g!g!g!g!e!~e!F!e!~

However, I said that this language was not merely a fancy reskin. It also includes a new operator, the stack duplication operator. Here is the syntax:
{operator chain}n
This implies that there are reserved identifiers; these are the numbers 0-9 and the symbol {, }, and |. (The latter I will explain later.) This means that these symbols cannot be used in tandem with the stack duplication operator; that is, if any of the symbols pertinent to said operator are used in the preamble, they cannot be used within the code.
The last symbol is the | or “bar” operator. It can be thought of as the import operator in Python, except it doesn't depend on outside libraries, ergo, it is a self-sufficient program. The bar operator allows one to make certain function accessible and definable. Multiple bar commands should be on the same line. The bar line must precede the preamble, but not necessarily on a line of its own. Here is a list of all valid bar commands:
Command
Description of accessed command
|z
Set current value to zero
|d
Doubles the current value
|h
Halves the current value (floor division of {current} // 2)
|F
Sets the current value to  (fibonacci)
|H
Prints “Hello, world!”
|?
Conditional. Skips the next command if the current stack is zero.
|#
Allows numeric numbers to be set to the next
|c
Sets current value to the number of occupied cells
|C
Sets current value to the number of occupied positive cells
|X
Resets the holder to its original state and resets the IP.
|i
Allows for multi-character input, overriding values to house the string sufficiently, starting at pointer. (I.e., input = "Hello",
|*
Imports all the (non-bolded) commands in linear order.
|~
Imports all the (non-bolded) commands in reverse order.
|T
Imports “true” commands, keeping to the original sense of BF. (Working on specific definition)

When a bar command is used, it adds the function to the end of the list. E.g, if your preamble was hcD;, then the modified table would be like this:
<
h
>
c
+
D
-
hh
[
hc
]
hD
,
ch
.
cc
(sym9)
cD
(sym10)
Dh
Etc.
Dc
So, the Hello, world! program can be written as thus:
|Habc;bc

No comments:

Post a Comment