TeaScript

TeaScript is a language designed for code-golfing. A JavaScript program is a valid TeaScript program but TeaScript adds a few more things. This includes shorter property names, implicit i/o, ES2015 features, and smarter syntax. Anyone reasonably familiar with JavaScript can write a TeaScript program.

This page is severely out of date, please go to Read The Docs for the full docs

Overview
The main difference between JavaScript and TeaScript is shorter property names. Property-names are shortened to one-letter and because of only being one letter long, this can negate the need for periods. In addition, TeaScript adds smarter semantics such as the  operator which can remove the need for some brackets. Input is also stored in some variables. Output is implicit.

TeaScript is a compiled language, or specifically, transpiled. This is done with the help of Babel.js.

Input methods
Input is automatically stored in various variables. Because TeaScript is JavaScript, other functions such as  or   may also be used depending on the enviorment. TeaScript can take multiple inputs.

Output methods
The output is the value of the last evaluated expression. To put simply, this means that the last thing run is the output. The global  can also be used to output but this is not implemented yet in the online interpreter.

New Syntax
To avoid accidentally parsing within strings. In syntax can be relatively strict in some places.

Function declarations
To shorten function declarations, you can write  instead of

Normally, when defining functions, you would need to write something like this:

array.map((item, index, array)=> /* code */ )

To avoid rewriting this over and over. You can simply use a  instead:

array.map(#/* code */)

This will compile to...

array.map((l,i,a)=>/* code */)

Array / String indexes
This works in a similar way as above. When you have a function and then and then an array key. You may use an alternative syntax to shorten this.

Essentially what the  does is:   where n is a digit or letter becomes:

An example, if you were to get the n-th item from a string:

string.slice(x,y)[z]

This can become:

string.slice(x,y#z

Removing periods
In some cases you can completely remove periods (e.g.  ->  ). After the characters, any letter/character will be considered a property. That probably sounds confusing so if you speak regex, it's matched by,. The full RegExp used is:

Because this is probably very confusing, some examples:

x.S(3) -> xS(3) l.S(3) -> lS(3) i.S(3) -> iS(3) a.S(3) -> aS(3) b.S(3) -> b.S(3) // Period can't be removed because of 'b' And for parenthesis:

x.S(3).s`` -> xS(3)s`` b.S(3).s`` -> b.S(3)s``

Abbreviations / Property Names
The shortening or property names is probably one of the most important aspect of TeaScript, because new built-ins / shortened property names are added all the time, it would be difficult to keep this list up to date. You may see the list at website.

1-byte Special Characters
With ISO-8859-1 (not UTF-8), certain characters will be replaced with longer character sequences at compile-time.

Àl+',')

Will be converted to:

x.l(#+',')

A full list of these can be found in the properties json file, here (line 68).

Compilers / Interpreters

 * Online Interpreter w/ Docs