# Home

Silicon is a programming language highly inspired by JavaScript and more specifically TypeScript, aiming to provide more efficiency and reliability while keeping the syntax as simple as possible.

## Prerequisites

* [LLVM](https://llvm.org) (v9) - [source](https://github.com/llvm/llvm-project)
* [Bison](https://www.gnu.org/software/bison) (v3.5) - [source](http://git.savannah.gnu.org/cgit/bison.git)
* [RE2C](https://re2c.org) (v1.3) - [source](https://github.com/skvadrik/re2c)

## Authors

* **Ardalan Amini** - *Core Maintainer* - [@ardalanamini](https://github.com/ardalanamini)

See also the list of [contributors](https://github.com/silicon-lang/silicon/contributors) who participated in this project.

## License

This project is licensed under the Apache License 2.0.\
See the [LICENSE](https://github.com/silicon-lang/silicon/blob/master/LICENSE) file for more details.


# Data Types

### The Boolean Type

As in most other programming languages, a Boolean type in *Silicon* has two possible values: `true` and `false`. Booleans are one bit in size. The Boolean type in *Silicon* is specified using `bool`.

### Integer Types

|  Length | Signed |
| :-----: | :----: |
|  8-bit  |  `i8`  |
|  16-bit |  `i16` |
|  32-bit |  `i32` |
|  64-bit |  `i64` |
| 128-bit | `i128` |

### Floating-Point Types

| Length |  Type |
| :----: | :---: |
| 16-bit | `f16` |
| 32-bit | `f32` |
| 64-bit | `f64` |


# Variables

### Dynamic Variables

{% code title="src/main.si" %}

```
fn main() {
    let integer1: i32 = 22;
    let integer2 = 202;
    
    let boolean1: bool = false;
    let boolean2 = true;
}

```

{% endcode %}

### Constant Variables

{% hint style="warning" %}
This section is not implemented yet.
{% endhint %}

{% code title="src/main.si" %}

```
fn main() {
    const integer1: i32 = 22;
    const integer2 = 202;
    
    const boolean1: bool = false;
    const boolean2 = true;
}

```

{% endcode %}


# Functions

Functions are the fundamental building block of any application in Silicon.

You’ve already seen one of the most important functions in the language: the `main` function, which is the entry point of many programs. You’ve also seen the `fn` keyword, which allows you to declare new functions.

*Silicon* prefers *snake case* as the conventional style for function and variable names. In snake case, all letters are lowercase and underscores separate words.

{% code title="src/main.si" %}

```
extern fn printf(format: string, ...): i32;

fn hello_world() {
    printf("%s\n", "Hello World!");
}

fn main() {
    printf("%s\n", "Calling hello_world function...");
    
    hello_world();
}

```

{% endcode %}

Function definitions in *Silicon* start with `fn` and have a set of parentheses after the function name. The curly brackets tell the compiler where the function body begins and ends.

We can call any function we’ve defined by entering its name followed by a set of parentheses. Because `hello_world` is defined in the program, it can be called from inside the `main` function. Note that we defined `hello_world` *before* the `main` function in the source code.

#### Function Parameters

Functions can also be defined to have *parameters*, which are special variables that are part of a function’s signature. When a function has parameters, you can provide it with concrete values for those parameters. Technically, the concrete values are called *arguments*, but in casual conversation, people tend to use the words *parameter* and *argument* interchangeably for either the variables in a function’s definition or the concrete values passed in when you call a function.


# Comments


# Control Flow


# Operators


# Interfaces

```
interface Name {
    first: string;
    last: string;
}

interface Person {
    name: Name;
    age: i32;
}

interface WithLicense {
    licensed: bool;
}

interface Doctor extends Person, WithLicense {
    field: string;
}
```


# Classes


# Modules


