Skip to main content

Silicon: A new language made with Python.

Project description

💎 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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

silicon_py-0.3.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

silicon_py-0.3.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file silicon_py-0.3.1.tar.gz.

File metadata

  • Download URL: silicon_py-0.3.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for silicon_py-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a2750b6375b604b887c6f5cc181816be54d3df6502e126d03ad0b46d74c53312
MD5 073967fb77509bbca88b38aa441f5578
BLAKE2b-256 3661eaf3afda19e8135496b7b2d9fb085076487451866ee74ab89222eb3b9bbf

See more details on using hashes here.

File details

Details for the file silicon_py-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: silicon_py-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for silicon_py-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a28ef67bdbdeddbcb8623b9a35b0ffb238cfde139a026855191a6519a53d7f0e
MD5 509a7e9fc09ee85e31ed3aad0f45fd02
BLAKE2b-256 4ef19830f3a3cc244d8473de3818ad3f7a6404a6c30a791e7f1c7a092eedc9bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page