Quickstart
This document is still a work in progress
Install Python 3.6+.
Tulip needs Python to run properly. If you don’t have python installed then go to Python and install the latest version. Once you have Python setup, you need to clone this repository and open a terminal inside the folder. Then you must type:
C:\Users\...\Pansy> python shell.py
-
You should see:
Pansy>
You can exit anytime using the command:
exit
Now you are ready to start! 😀
How to run a Tulip file ?
Let’s imagine you want to run the code that is in the
directory:
examples/HelloWorld/code.pansy. You just need to use the command:
Pansy> run("examples/HelloWorld/code.pansy")
You can also execute your code from outside the Tulip shell:
C:\Users\...\Pansy> pansy.py examples/HelloWorld/code.pansy
Data types
Note
Currently there are 4 data types:
Integer
Float
String
List
Dictionaries
Assigning variables
var x = <value>
-
Integer
var i = 1
-
Float
var f = 5.0
-
String
var s = "This is a string"
-
List
var lst = [1,2,3]
-
Dictionaries
var dict = {"key": value}
Number Operations
-
Sum
Pansy> 5 + 2
@ 7
-
Subtraction
Pansy> 5 - 2
@ 3
-
Multiplication
Pansy> 5 * 2
@ 10
-
Division
Pansy> 5 / 2
@ 2.5
-
Int Division
Pansy> 5 // 2
@ 2
-
Remainder
Pansy> 5 % 2
@ 1
-
Power
Pansy> 5 ^ 2
@ 25
Comparisons
There are 6 comparisons operators in Tulip. They all have the same priority (which is higher than that of the Boolean operations).
Operation |
Meeting |
|---|---|
== |
Equal |
!= |
Not equal |
< |
Strictly less than |
> |
Strictly greater than |
<= |
Less than or equal |
>= |
Greater than or equal |
Boolean operators
All the boolean operators have the same priority.
Operation |
Result |
|---|---|
x or y |
if x is false, then y, else x |
x and y |
if x is false, then x, else y |
not x |
if x is False, then True, else False |
Comments