GOTO++

GOTO++ is a parody programming language designed by Sidoine de Wispelaere with help from Alexandre Béraud, based on the extensive use of GOTOs and labels (despite them being traditionally "considered harmful" in the programming community). Its keywords are some interesting mix of English and French.
Targeted to a French-speaking userbase, its esotericness lies in its purposely confusing syntax and semantics, the probabilistic nature of certain language elements, and the humorous tone of official material related to the language (mostly written in French).
For instance, "function arguments must be to the right of the left parenthesis, but nothing is said about the right parenthesis", allowing commands like:
 GOTO This is a comment
 GOTOPRINTDUTEXTE() «Hello World!»
Note: "du texte" means "some text" in French, and "print" means nothing in French: It's a pure English word.
Other than that, it is a fairly general-purpose scripting language : as such, it may be seen as more of a Weirdlang than a true esoteric language, somewhere between LOLCODE (for the replacement of keywords with slang terms) and INTERCAL (for the confusing semantics and lack of seriousness).
==Presentation==
GOTO++ is a high-level, weakly-typed, procedural language with supports object-oriented programming. Described by the authors as "the language that doesn't go easy on you" (in French : "le langage qui se laisse pas faire") it claims to be difficult to write and read code in. Its mascot looks like a green warthog with angry red eyes, symbolizing its "untamed" nature.
As its name suggests, it encourages the use of labels and GOTOs while dismissing alternatives such as loops, even though these are actually present in the language through a special "guru" mode.
Many elements of the language work in a probabilistic manner, making programs unpredictable : the documentation jokingly praises this as a revolutionary feature of the language. In fact, there are ways to circumvent the randomness, but programmers are advised against it in a tongue-in-cheek manner.
GOTO++ is bundled with a standard library providing basic features such as network capability and string operations, although the semantics are confusing (see "Style & Humor").
On the official website is hosted the CGAN (Comprehensive Goto++ Archive Network, a parody of Perl's CPAN and TeX's CTAN) which is a repository of various GOTO++ programs and libraries.
The official implementation is an interpreter named gotopp which compiles GOTO++ code into bytecode and runs it in its VM. It is written in C++ and is open-source and multi-platform. It seems to only support ISO 8859-1 encoding, something programmers must keep in mind since certain essential syntax elements lie outside the ASCII range.
==Style & Humor==
The official documentation is written entirely in French, which the official website calls "the most beautiful language of the world"; said website also advises English-speaking readers: "Too bad, you will have to learn french". The names of functions and classes from the standard library are in a mix of French and English, with arbitrary casing (note: GOTO++ is case-sensitive), silly puns and pop-culture references. Such is the general tone of GOTO++: ironic French chauvinism, informality, and a rude, confusing attitude towards users.
Oddly enough, the language is centered around the word "GOTO" which is derived from English (although the authors advise English-speakers to pronounce the "GOTO" in "GOTO++" as goh-toh, "like every good frenchman" would). Furthermore, most of the official website, outside the documentation, is available in (imperfect) English.
==Syntax==
===Statements===
In GOTO++, there is at most one statement per line and a newline usually marks the end of the statement. The caret (^) is used as a continuation character.
===Comments===
Single-line comments start with the GOTO keyword : the compiler ignores any following text until the end of the line. Example:
 GOTO This is a single-line comment
Multi-line comments are surrounded by #! and !#, a subversion on the shebang.
 #! This
 is a
 multi-line comment. !#
===Variables===
Variables are named pingouins (French for "razorbill", although the word is often incorrectly used for penguins). The basic variable types are:
* Entiers (integers) which may be positive or negative. Literals must be surrounded by *( and ). Examples: *(42), *(-123)
* Chances is how GOTO++ refers to floating-point numbers. Literals use the comma as a decimal separator (as is the custom in France and some other European countries) and are prefixed by ?. Example: ?-90,5
* Caractères (characters) : literals are surrounded by *` and ' (single quote). Example: *`a'
* Chaînes (strings) : string literals must be surrounded by guillemets (used as quotation marks in French and other languages). The escaping character is the semicolon, used in a similar fashion as the backslash in C or PHP. Example: «This text ends with a newline character.;n»
Variable assignment is done with the = operator. Developers must be careful since any variable name on the right-hand side of a statement really represents a reference to that variable; dereferencing is done with the & prefix.
 J=*(2)
 GOTO The value of J is now 2
 K=J
 GOTO K is now a -reference- to J
 L=&J
 GOTO The value of L is now 2
===Operators===
Operator 	Function 	Comment
+ 	Add 	
- 	Subtract 	
MULTIPLICATION 	Multiply 	
: 	Divide 	Historically a division sign in France and other countries
RESTEDELADIVISIONPAR	Modulo 	Literally means "remainder of the division by"
++ 	Generic addition	Addition operator for non-numeric types such as references and characters
* 	Bitwise AND 	
+ 	Bitwise OR 	
~ 	Bitwise NOT 	
~~ 	Bitwise NOT-NOT 	Return "the complement of the complement" of a value. The documentation claims "there is a use for it" and that it is up to programmers to "figure it out".
< 	Shift left 	
> 	Shift right 	
ou 	Logical OR 	French for "or"
et 	Logical AND 	French for "and"
non 	Logical NOT 	French for "not" or "no"
sup 	Greater than 	From French supérieur
inf 	Less than 	From French inférieur
eg 	Equals 	From French égal
diff 	Not equals 	From French différent
supeg 	Greater or equal	
infeg 	Less or equal 	
Contrary to common usage, add and subtract operations are of higher precedence than multiply and divide. One may use pairs of braces to override precedence, similar to how parentheses are used in other languages -- although the right brace is used first.
 *(3) MULTIPLICATION *(4) + *(3) GOTO This equals 21
 } *(3) MULTIPLICATION *(4) { + *(3) GOTO This equals 15 (note the inverted pair of braces)
===Labels and Functions===
Labels are an essential component of GOTO++, they control the flow of the program. Label names are prefixed with the § symbol (a character available on French keyboards but not on most Anglo-Saxon keyboards, which is probably intentional) and label references are prefixed by %. They are used in statements such as GOTOPASMALIN (meaning "STUPIDGOTO") which despite its name, acts like a classic GOTO and jumps to a given label. For example :
GOTOPRINTDUTEXTE() ; «Step 1»
GOTOPASMALIN %2
§1
GOTOPRINTDUTEXTE() ; «Step 3»
GOTOFIN
§2
GOTOPRINTDUTEXTE() ; «Step 2»
GOTOPASMALIN %1
will print "Step 1", "Step 2" then "Step 3" (GOTOPRINTDUTEXTE() displays text on the standard output, and GOTOFIN stops the program).
GOTOGOTO, hailed as an essential feature by the documentation, is a probabilistic GOTO, which takes a list of labels and probabilities as input, and jumps to a random label from the list. If the sum of probabilities is less than 100%, the remaining probability is of program continuation without jumping to any label. When no probabilities are given, the default is 90%. For instance:
GOTOGOTO() %1 ?50 %2 ?40
will have 50% chance of jumping to label 1, 40% chance of jumping to label 2 and 10% chance of continuing right after the instruction.
Using the ASV (French Internet slang, like "A/S/L" in English) keyword, it is possible to add arguments to labels, effectively making them functions. A function block ends with the APLUS keyword (meaning "SEEYA") and functions may return a value using the REGOTO keyword.
§multiplyByThree:ASV(x)
	REGOTO &x MULTIPLICATION *(3)
APLUS
J=%multiplyByThree(*(4)) GOTO The value of J is now 12
As stated earlier, a quirk in the GOTO++ syntax is that in a function call, the function name must be followed by a left parenthesis but the right parenthesis may be put anywhere between the left parenthesis and the end of the line. Additionally, function arguments are separated by whitespace. Therefore the three following expressions will all produce the same result:
 %foo( *(1) *(2) )
 %foo() *(1) *(2)
 %foo( *(1) ) *(2)
===Troupeaux===
One language element is the troupeau (a "flock" of "penguins"). There are two types of "flocks": "flocks of anonymous penguins" and "flocks of declared penguins".
"Flocks of anonymous penguins" are effectively arrays with numerical, zero-based indexes. The index is surrounded by a pair of greater-than and less-than signs.
 J<*(3)>=*(5)
 GOTO The 4th element of J is now 5.
"Flocks of declared penguins" are GOTO++'s objects. They are declared with the troupeau keyword, followed by a list of pingouin declarations (i.e. attribute variables), and end with fintroupeau. Methods are supported with the machineapingouins keyword ("penguin machine"), i.e. functions that take "penguins" as parameters and might return a "penguin" themselves. A constructor method might be declared using the berger ("shepherd") keyword and static attributes and methods with the GIVRE ("frozen") keyword.
troupeau MyClass
	pingouin Jules
	pingouin Gustave
	pingouin Bertrand
	machineapingouins MyMethod
fintroupeau
GOTO Now we can instantiate an object like this
MyClass MyFlock
GOTO Members and method access is done with an at sign
MyFlock@Bertrand = *(5) GOTO The value of MyFlock@Bertrand is now 5
MyFlock@MyMethod(*(3)) GOTO The value of MyFlock@Bertrand is now 8
GOTOFIN
GOTO Here we define the method "MyMethod"
§MyMethod:ASV(a):MyClass
	Bertrand=+&a
APLUS
===Hash tables===
According to the documentation, hash tables are used for "hashing penguins". Their syntax is similar to arrays, except they use brackets instead of greater-than and less-than signs. They accept values of any type, but only strings may be used as keys.
 &key=«a key»
 J[&key]=«value»
When referencing a pair from a hash table, the # operator may be used to retrieve the value, while the " operator may be used to retrieve the corresponding key.
 Z=J[&key] GOTO Z is now a reference to a key-value pair
 GOTOPRINTDUTEXTE() ; &Z" GOTO This will print "a key"
 GOTOPRINTDUTEXTE() ; &Z# GOTO This will print "value"
==Examples==
===Hello World===
The official distribution provides the following as a "Hello World" example:
GOTO Le premier "Hello world"
§100
GOTOPRINTDUTEXTE() ; *`s' *`r' *`e' *`v' *`i' *`n' *`u' *` ' *`o' *`l' *`l' *`e' *`h'
§2989
GOTOPRINTDUTEXTE() ; *`d' *`l' *`r' *`o' *`w' *` ' *`o' *`l' *`l' *`e' *`h'
GOTOGOTO() %2989 ?50 %100 ?40
The first instruction is really a comment. Since GOTOPRINTDUTEXTE() processes its parameters from right to left, the program will print "hello univers", then "hello world", then the last instruction has a 50% chance of going back to label 2989, 40% of going back to label 100, and the remaining 10% chance of continuing after the instruction, which will effectively terminate the program.
However, this is really a joke example in the spirit of GOTO++, with purposely hard-to-read code and probabilistic elements. A much simpler program would be:
 GOTOPRINTDUTEXTE() ; «Hello World!»
==History==
The official website claims that GOTO++ was conceived in the mid-nineties by the scientists of "NIACsoftware". The earliest public release was Version 0.05 in April 2002.
As of July 2016, the latest version is 0.30, released on April 1, 2006, which notably introduced the use of the Boehm garbage collector as well as "a lot of bugs" (according to the authors). From 2006 to 2015, official support slowly came to an halt, with only a few patches released, and interest in the language faded.
However, a renewal of interest in the language in mid-2015 prompted the authors to put the source on Github and start making updates to it, which suggests development might be put back on track in the future.
==See also==
* GOTO 10
==External resources==
* GOTO++ website
* The project on Github
* CGAN Repository
* Gotong, an ASCII Pong-like game in GOTO++ (in French)
Category: Languages
Category: 2002
Category: Implemented
Category: Unknown computational class