Home

News

International

Screen Shots

Documentation

Download

Build

License

Credits

Contact

SourceForge Project

Tintware Documentation : Tint Programming Language : Tint Tutorial : Tutorial Introduction

Introduction

Most of the examples come as two lines; the first line is what is being evaluated and the second line is the result. If this is not the case, it will be noted otherwise.

In most programming languages, code is the default and strings must be escaped, for example in C and C++, by "double quotes." Tint is the opposite; most strings are the default and code is specified by special characters. The special characters are tab, newline, #, comma, and parentheses.

Tabs and newlines are discarded when they get evaluated. Parentheses can be used to prevent evaluation -- then they get discarded. In the following example, both sets of square brackets contain tabs. After evaluation, only the second set still contains a tab -- the parentheses protected the tab.

[	]([	])
[][	]

An object call is indicated by using #( and ). Comma is used to seperate the object and the arguments. The arguments are seperated by comma as well. For example, + can be used to add numbers together.

#(+,1,2,3,4)
10

Subtraction (-) , multiplication (*), and division (/) work as you would expect. Procedure calls can be arbitrarily nested. The following example might require a closer look. The result of #(-,10,5) is 5 and the result of #(*,2,3) is 6. The 5 and 6 are concatenated together, so / is called with 56 and 2 as arguments.

#(/,#(-,10,5)#(*,2,3),2)
28

The namespace is a hierarchy of objects; for example, + is a primitive. Primitives are procedures which are built into Tint. The top of the namespace is a dictionary (dict). Most of the primitives are under system. A period (.) is used to seperate the different parts of the namespace. The primitive, tint.type can be used to determine the type of an object in the namespace.

#(tint.type,)
dict

The top of the namespace is a dictionary as expected.

#(tint.type,system)
dict

And system is a dictionary as well.

To define a string, use def.

#(def,a-string,the value)

And to get its value, use an object call specifying the name of the string as the object.

#(a-string)
the value

dict is used to define a new dictionary. In the following example, first we define a new dictionary, then we define a string in the new dictionary, then we ask for the type of the object (should be a string) and its value.

#(dict,foo)#(def,foo.bar,baz)#(tint.type,foo.bar) #(foo.bar)
string baz

Finally, to perform flow control, the = and > procedures can be used. To determine if two strings are character wise equivalent, use =. To determine if one number is greater than another number, use >. Before > does the comparision, the two arguments being compared are convert to numbers. For both cases, if the comparison of the first and second arguments is true, then the third argument is returned, otherwise, the fourth argument is returned.

#(=,a,b,yes,no)
no
#(>,10,5,yes,no)
yes