- 1 Etymology
- 2 Keywords
- 3 Character set
- 4 Datatypes
- 5 Syntax
- 6 Scope
- 7 Output
- 8 Operators
- 9 String indexing
- 10 String expansion
- 11 Examples
- 12 Computational class
This language got its name from a key letter (e.g. H for HELLO, N for THEN) from each keyword’s wimpmode name in order.
|TTTT||Function return; string indexing||IT|
|TTTTT||Variable initialization/assignment; equality||IS|
|TTTTTT||End if; end if/else||THEN|
|TTTTTTTT||Addition; string concatenation||AND|
The 'Normal' column is the keyword's non-wimpmode representation.
HGFTSNOA uses the following 16 characters:
There are no escape codes in HGFTSNOA strings, which can only contain 15 characters (HGFTSNOA’s 16 characters minus the double quote ", which can’t be escaped) without using the string expansion operator
The program’s nameless “main” function (which can’t be called in the program) is where all code (except for function declarations) is. It’s between T (BEGIN) and TT (END):
T ... TT
vname TTTTT value
vname must match the following regex:
t+, and must not be
fname TTTTT T ... TT
fname has the same limitations as variable names, and also can’t be the name of a variable.
Example (add 2):
t TTTTT tt ttt T TTTT tt TTTTTTTT ttt TT
This example takes two arguments (tt and ttt) and returns their sum using the TTTTTTTT keyword. Another example (add 4):
tt TTTTT ttt tttt ttttt tttttt T TTTT tt tt ttt tttt tt ttttt tttttt TT
This example uses the previous example (with no confusion in the parameter names, they’re in different scopes—see #Scope) and uses HGFTSNOA's MyScript-like parameter system to add the first two arguments, then the second two, and then return the sum of those two sums.
TTT value code if true... TTTTTT
TTT value code if true... TTTTTTT code if false... TTTTTT
value evaluates to false if it’s equal to 0 or "", otherwise it evaluates to true. Booleans don’t really exist in HGFTSNOA, and when used as the equality operator, TTTTT (IS) returns 1 for true or 0 for false.
T t TTTTT 123 tt t TT tt TTTTT T t TTTTT 456 TT
will print 123, because of scope. There is no "global scope", functions are available everywhere in the program, and variables are available only in the function they were created in/passed as arguments to.
Output in HGFTSNOA is implicit, meaning all values not passed to functions or used in expressions are printed to STDOUT followed by a newline. This doesn’t go for function return values, however, meaning that you have to assign function return values to variables in order to print them.
There are 4 operators in HGFTSNOA: -, TTTT (IT), TTTTT (IS), and TTTTTTTT (AND). They all have the same precedence and are evaluated LTR, but function calls have a higher precedence, so
1 TTTTTTTT f 2 3 4 TTTTTTTT 5 would in many languages be
1 + f(2, 3, 4) + 5.
With an integer LHS, the - operator is the unary negation operator and the TTTTTTTT (AND) operator is the binary addition operator. The negation operator returns 0 subtracted from its LHS, and the addition operator returns its LHS added to its RHS converted to an integer (or 0 if invalid).
With a string LHS, the - operator is the unary expansion operator and the TTTTTTTT (AND) operator is the binary concatenation operator. The expansion operator returns its “expanded” LHS (see #String expansion), and the concatenation returns its LHS concatenated with its RHS converted to a string.
When not used for assignment, the TTTTT (IS) operator is the binary equality operator with any LHS and RHS. It returns 1 if and only if its LHS has the same type and value as its RHS, otherwise 0.
With a string LHS and an integer RHS, the TTTT (IT) operator is the binary indexing operator (see #String indexing).
The following expression will return the (0-based) Nth character of string S (N < 0 → N = S.length - N; abs(n) > S.length → res = empty_string):
S TTTT N
So the following code:
T "1234567890" TTTT 7 -"T" TTTT 1 TT
Putting a negative sign (-) directly before a string “expands” it, causing all keywords to turn into their wimpmode equivalents and all variables to turn into their values, so the following:
T t TTTTT 123 -"T t" -"Tt" -"T" TTTTTTTT " t" tt TTTTT "T" TTTTTTTT " t" -tt TT
HELLO 123 HELLO123 HELLO t HELLO 123
This process is not permanent, and any expanded variables will stay the same unless explicitly assigned their expanded version. String expansion is the only way to print letters other than T and t. With it, you can also print the letters A, B, D, E, F, G, H, I, L, N, O, R, S, and Y.
“HELLO” program (“W” can’t be output)
T -"T" TT
This example uses string expansion with the T (HELLO) keyword to print "HELLO", and since no wimpmode keyword contains the letter W, “WORLD” can’t be output.
Truth-machine for variable
T t TTTTT (0 or 1) TTT t TTTTT 1 tt TTTTTTT 0 TTTTTT TT tt TTTTT T 1 tt TT
Output all characters of variable
t (string) separately
T t IS some string tt 0 t TT tt TTTTT T ttt t tttt IS t IT ttt IF tttt IS "" OR tttt tt ttt AND 1 t THEN TT
Fibonacci numbers until variable
t (finish) (help in InfiniteGoto interpreter)
T t TTTTT (any number) IF ttttt(t, 0) 0 tt t 0 1 THEN TT tt TTTTT t ttt tttt T IF ttttt(ttt, tttt) IT 0 OR tttttt IS t t IS tt tt IS tt AND tttttt THEN TT ttttt TTTTT t ttt T # t > ttt for all non-negative t and ttt IF ttt IS 0 IF t IS 0 IT 0 OR IT 1 THEN OR IT ttttt(t AND -1, ttt AND -1) THEN TT