Skip to main content

Silicon: A new language made with Python.

Project description

💎 Silicon.py (v0.3.2)

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.
  • v0.3.1: Bug fixes
  • v0.3.2: Bug fixes

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.2.tar.gz (9.2 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.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: silicon_py-0.3.2.tar.gz
  • Upload date:
  • Size: 9.2 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.2.tar.gz
Algorithm Hash digest
SHA256 e45fee3413995f05d64bedf40c64f5da563e4fb35f61bfaf413e684b0406409a
MD5 cb72af8e7fb8181a001f3f89f90d5e63
BLAKE2b-256 9e96f9bdb0ac36ca313234e56c00c00385d84e099e52bd9e1481e4fb2d24922f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: silicon_py-0.3.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cc2e693c0821762b813db9a3ed46de4d50e149a9cbbabb5a3a360807e9faa3b3
MD5 da437251e7e0481d9f9c7dcd2a844fd8
BLAKE2b-256 ac0c97beb7e190bbb1ae727e9daa68f447a6b3863d77d3d33a5ce29a6bd04a8d

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