Language basics

Stack

LilTea is a stack-based programming language with a single stack. Every operations performs a action on the stack and pushes the result. This is a domain specific language made for golfing challenges. Its based on JavaScript so you will have to have Node.js as interpretator and thats all.

Your are ready to use LilTea!

Atoms

Atoms are the main part of the language. They are built-in functions making solutions quite easier and faster. Below you can see a list of all the atoms LilTea supports and thanks to the implementation of the language and that they can be added easily so many more are on the way!

lilTea symbol bigTea symbol Explanation
+ add
- subtraction
* subtraction
/ divide
% modulo
$ at
null ascendingSort
null descendingSort
null square
null sqrt
null dup
null tan
null sin
null cos
null empty
null stackLenght
null element
m elementPop
= compare
p print
P printPop
. increment
_ decrement
null toString
null toInteger
null toArray
null fact
null ceil
null floor
g bigger
l less
& bitswiseAnd
| bitswiseOr
x bitswiseXor
n notEqual
^ pop
O doubleDup
s swap
t debugPrintStack
~ NOP

Simple solutions

If you want to sum the numbers 6 and 5 in the stack all you have do is the following:
                    
node ./source.lit 5 6
                    
            
And your source file should be:
                    
+
                    
            

Language core

In order to understand LilTea you will need to know the basics of working with a stack.

In computer science, a stack is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and. pop, which removes the most recently added element that was not yet removed.

Pushing

In LilTea pusing values to the stack can be done either on the command line:

                
node ./source.lit Hello!
                
            

Other way of pushing is by using an atom or a litereal:

                
5>Hello!<'g
                
            

Poping

Poping values can be done by atoms that uses the last value of the stack and pops it

                
5>Hello!<'gP
                
            

Peaking

Peaking a value means getting the last value of the stack without popping it. This can be done either an atom that "peaks" the last value or using a modificator for preventing poping

                
>LilTea!<p
                
            

Prelexer

The prelexer is responsible for the literal completion system so

                    
5+6>asd
                    
            

and

                    
5+6>asd<
                    
            

should be the interpretated the same way.

Lexer

The lexer tokenizes the input into tokens as it follows:

Literals

The literals LilTea supports are:

  • Numbers
  • Strings
  • Chars
  • Arrays
           
    5 // literal for number
    'c // literal for characters
    >Hello World!< // literal for Strings
    [1,2,>Hello!<] // literal for Array
            
            

Conditionals

Like every other language LilTea has all the known conditeonal statements. For instance:

                    
=>STATMENT<Ø?p
                    
        
The following code is read like this:
    
= // Operator for equality, checks the quality of the last two elements in the stack
>STATEMENT<// string literal to be pushed to the stack 
Ø// Atom reversing the steck
p// the atom to be executed if the comparisment had return true (else)
    
        

Modifiers

LilTea supports stack modificators making the work with the stack easier.
Symbol Explanation
× Preventing the next operation to pop values from the stack
Ø Makes the next operation take argument from the begging of the stack
ΠMakes the next operation "greedy"

Variables

LilTea also supports built-in variables for easier access to infromation. There are 6 variables and they are labeled like the first 6 letters of the alphabet(A,B,C,D,E,F). Working with them is easy. For example:
        
>Hello!<a // Sets the variable A to the string Hello!
        
Then later you can add the variable to the end of the stack by just calling:
            
A // Pushes the Hello! to the end of the stack
        
All the variables have default value of often used values in solving golding problems:
Variable Default value
A The english alphabet as an array
B [0,1,2,3,4,5,6,7,8,9]
C PI
D Todays date
E Hours of the day
F Minutes of the day

Try liltea now:

Who are we?

We are two students from eleven grade from TUES, Bulgaria. We hope this project will be a good start for our careers.

Here is our githutb repository with all the work we have done so far:

                    
https://github.com/LilTea/liltea
                    
                
default_picture

Name: Dartin Macev

Role: Developer, creator

Github: https://github.com/mdatsev

default_picture

Name: Gladislav Veorgiev

Role: Developer, creator

Github:https://github.com/VGeorgiev1