Skip to content

A small program as a compiler for my own small language, YoctoScript.

License

Notifications You must be signed in to change notification settings

UnknownDecoder/yoctoscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YoctoScript

A minimal scripting language and interpreter for learning, experimentation, and fun.

Overview

YoctoScript is a lightweight scripting language, designed to be simple and approachable. The core of the project is the Yoctium interpreter, which executes YoctoScript code and allows you to experiment with language design and scripting.

Features

  • Variable Declarations — Use var x = 5 to create variables.
  • Function Calls — Built-in calls like Console.display("Hello").
  • Built-in Types and Functions — Includes String, read (for input), and more.
  • Command-Line Execution — Run .ys scripts directly from the terminal.
  • Error Reporting — Helpful errors with line numbers.
  • Easy to Extend — Simple Python codebase for adding your own features.

Installation

Install the package via pip:

pip install Yoctium

Usage

Import and Run Code in Python

from Yoctium import Yoctium

code = '''
var x = 5
Console.display(x)
'''

interpreter = Yoctium()
interpreter.run_code(code)

Run YoctoScript Files from the Command Line

After installation, you can run YoctoScript files (with .ys extension) directly:

yoctorun my_script.ys

This will execute the code stored in my_script.ys.

Example YoctoScript

var name = read("What is your name? ")
Console.display("Hello, " + name)

Save as hello.ys and run:

yoctorun hello.ys

License

Apache License 2.0

About

A small program as a compiler for my own small language, YoctoScript.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages