Skip to main content

toyc

A toy compiler with Vulkan and OpenGL GPU backends, written in Python.

Install

pip install toyc

What's inside

  • Lexer / Parser / AST — tokenizes and parses a simple toy language
  • Evaluator — tree-walk interpreter
  • VM — bytecode virtual machine

To do

  • GPU backends — Vulkan and OpenGL compute backends via toyc.gpu

Usage

from  toyc  import Parser , Lexer , Flattener , vm
from toyc import Compiler ,Cpu 
# example code
code = "1 + 2 * 3"

# tokonizer of the code
token = Lexer.tokenize(code)
print(token ,"\n")

# prashing building an ats tree 
ats = Parser.parse(token)
print (ats,"\n")

Cpu.run(program="program.toy")

Gpu detection (not compliling yet, andno opengl vulkan only)

from toyc import gpu.GpuValkan

db = gpu.Gpuvalkan

ps: you can call it it wont print anything yet, iam still wokrcing on the class and its function

License

See LICENSE.

Metadata

Release files for toyc 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toyc 0.1.4
File Size Uploaded
toyc-0.1.4.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for toyc 0.1.4
File Interpreter ABI Platform
toyc-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 43.8 kB

Release files / toyc-0.1.4.tar.gz

Download URL toyc-0.1.4.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cfb72244181e422a33b05a60e363a579ad4d6d77ec3c7de76a0f5dcff3dcd001
BLAKE2b-256 checksum
How to use checksums
7875b753c7a05a828a2d53d11c58008d055cc1470ae32a7d8b7f6c7adda75c70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / toyc-0.1.4-py3-none-any.whl

Download URL toyc-0.1.4-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
635021e13a26df3df5f2c172a529946ff55617511283a7e3e554669c1905c11c
BLAKE2b-256 checksum
How to use checksums
018ec887384f4562908dfa1f64a02215890ceaebf5eb5a6cc82b4af927abd6f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

This release

0.1.4 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page