# **💎 Silicon.py (v0.3.0)**

**Silicon** is a custom-built, high-logic programming language designed for structured data manipulation and iterative logic. Built with the "Industrial Library" philosophy, Silicon separates data into distinct namespaces (vars, arrs, funcs) to ensure maximum memory clarity and zero variable shadowing.

## **🚀 Installation**

Silicon.py is available on PyPI. Install it globally or in your virtual environment:

`pip install silicon.py`

## **🛠 Usage**

Silicon.py uses the .sil extension. Once installed, you can execute your scripts using the sili command:

`sili your_script.sil`

## **🏗 Language Syntax**

Silicon.py introduces a unique **Action-Library** syntax. To modify data, you must call the action through the appropriate library.

### **1. Variables and Arrays**

Definitions and assignments are distinct steps. This ensures intentional memory allocation.
```
~~ Define your data ~~

define(type:Var = playerName)    
define(type:Arr = inventory)

~~ Set values using the Library:Action syntax ~~

vars.playerName:Set("Architect")    
arrs.inventory:Set("Hammer", "Shield", "Silicon Core")
```
### **2. The cond() Logic (v0.2.2+)**

Silicon.py v0.2.2 replaced the traditional if with the unified cond() system. It supports single-pass conditions (if) and loops (during).

**Supported Logic Operators:**

* `alt;` (OR)  
* `also;` (AND)  
* `not;` (NOT)
```
cond(during vars.health > 0):    
    log(console, "Character is alive...")    
        
    cond(if vars.energy < 10 also; vars.hasPotion == true):    
        log(console, "Energy low! Drinking potion...")    
    :end    
:end
```
### **3. The math library (v0.3.0+)**

In silicon.py v0.3.0, a couple of new features released. One of these include the new math library. This library allows for complex calculations directly within your Set actions or logic checks.

**Available Operations:**

* `math.sqrt(x)`: Returns the square root of x.  
* `math.rand()`: Generates a random integer between 0 and 1.  
* `math.rand(max)`: Generates a random integer between 0 and `max`.  
* `math.abs(x)`: Returns the absolute value of x.

**Example:**
```
define(type:Var = luck)  
define(type:Var = rootVal)

~~ Generate random number between 0 and 10 ~~  
vars.luck:Set(math.rand(10))

~~ Calculate square root of 64 ~~  
vars.rootVal:Set(math.sqrt(64))
```
### **4. String Combination (v0.3.0+)**

Silicon v0.3.0 introduces the combine() function, allowing you to dynamicly stitch together strings, numbers, and variable values without complex concatenation syntax.

**Syntax:** `combine(val1, val2, val3, ...)`

**Example:**
```
define(type:Var = user)  
vars.user:Set("Admin")

~~ Output: "Welcome back, Admin. System ready." ~~  
log(console, combine("Welcome back, ", vars.user, ". System ready."))
```
### **5. Execution Control (v0.3.0+)**

To manage the flow of your program, v0.3.0 adds the delay() logic. This pauses script execution for a specified number of seconds.

**Syntax:** `delay(seconds)`

**Example:**
```
log(console, "Initializing core...")  
delay(2)  
log(console, "Core active.")
```

## **📑 Roadmap**

* [x] **v0.2.2**: Unified `cond()` logic and semantic operators (`alt;`, `also;`).  
* [x] **v0.2.3**: Official rebranding to **Silicon**, `.sil` extension, and `sili CLI`.  
* [x] **v0.2.4**: Added `README.md` for better guides of use.  
* [x] **v0.2.5**: Updated `README.md` for better guides of use.  
* [x] **v0.2.6**: Updated console logging to `[SILICON]`.  
* [x] **v0.2.7**: Allowed usage of `sili --version`.  
* [x] **v0.3.0**: Added `math` library, `delay()` logic, and `combine(x, y, z)` to conjoin strings, numbers, and variables.