Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Hello World

SjVer edited this page Jul 2, 2021 · 16 revisions

1. Hello World

In this chapter I will introduce you to Tic in the most traditional way possible: a script that prints "Hello World!" to the screen.
This chapter also shows you how to install the Tic compiler (linux) and how to use it. At the end of this chapter you will have your first Tic script compiled and executable!

Your First Script

I won't let you wait any longer. This is Hello-World.tic, Tic's Hello World:

PrintLine "Hello World!"

Pretty simple eh? As you can see, Tic does not use semicolons at the end of each line. Another thing to note is the file extension: .tic. This extension is important as it's the only filetype supported by Tic's compiler, which we'll get to next.
PS: You could also use Print instead of PrintLine, but that leaves out the trailing newline which just looks uglier.

Installing Ticcomp

Before actually compiling and executing anything, we need the Tic compiler. The installment of ticcomp is pretty straight forward:

  1. Head on over to the releases page of Tic's github repository. Here you can find all its releases. Make sure to download the latest one (1.4 as of writing this chapter). The file you have to download is the .deb file.
  2. Once downloaded open up your favourite linux terminal and enter the directory you saved the .deb file in (probably ~/Downloads).
  3. Enter the following command to install ticcomp:
    sudo apt-get install ./<filename>.deb
    Make sure to replace <filename>.deb with the name of the file you downloaded in step 1! After executing this command, the compiler should be installed. (If not, contact me.)

Getting used to Ticcomp

Now we're all good to go! First, validate your installation by running ticcomp --version. The correct version should be displayed.
The ticcomp command comes with a few positional and optional arguments. Run ticcomp --help to display them.
Screenshot
That might be quite a lot at once, so let's break down the options and arguments that'll matter in this series.

  1. input
    This is the only positional argument, meaning that it must be given. You probably already guessed what you'll need to give here: the Tic script you want to compile.
  2. -o / --output
    This is the optional argument you'll probably be using the most. When used, an output file must be supplied. Using this option simply spits the compiled executable out as the specified file instead of e.g. ./bin/hello-world.
  3. -r / --run
    When used, this option simply runs the script directly after a successfull compilation. Handy for quick debugging.
  4. -v / --verbose
    When used, the compiler will spit out an abundance of information such as the intermediate c code. This option is, however, mostly usefull for me, the developer.

    Let's try it out. Firstly, save PrintLine "Hello World!" to hello-world.tic in your filesystem (I reccomend creating a seperate directory for this course). Then, enter the directory you saved your file to and enter the following command:
ticcomp hello-world.tic

If all goes well, a bin directory should appear and within that directory a file called hello-world. This is the tic executable! Let's try it out:
Screenshot
It works! Now we can get to the real stuff...

2. Variables

Home

  1. Hello World

  2. Variables

  3. If-Statements

THIS COURSE IS STILL IN DEVELOPMENT. THE NEXT CHAPTERS ARE BEING WORKED ON.

  1. Control Flow

  2. Functions

  3. Advanced Keywords

Clone this wiki locally