No project description provided
Project description
tr-lang-py
Python bindings for tr-lang
Installation
$ pip install tr-lang-py
Usage
To Run Inline tr-lang Code
from tr_lang import Lexer, Parser, Run, bytecode
code = """
'Hello, World!\\n' de
"""
lexer = Lexer(code)
parser = Parser(lexer.tokenize())
bytes = bytecode.to_bytes(parser.parse())
run = Run(bytecode.from_bytes(bytes))
run.run() # prints "Hello, World!\n"
To Use tr-lang Files with Python
# /path/to/file.py
from tr_lang import Lexer, Parser, Run
with open("/path/to/tr-lang/file.trl") as f:
Run(Parser(Lexer(f.read()).tokenize()).parse()).run()
# /path/to/tr-lang/file.trl
"What is your name? " de # print("What is your name?", end="")
girdi -> name # name = input()
"Your name is " de name de ".\n" de # print(f"Your name is{name}.")
To Use tr-lang Bytecode from Python
from tr_lang import Run, bytecode
with open("/path/to/bytecode.trl.byt", "rb") as f:
Run(bytecode.from_bytes(f.read())).run()
Documentation
Contributing
To report bugs or suggest new features please use the issue tracker
Bugfix PR's are welcome!
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
tr_lang_py-0.2.0.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tr_lang_py-0.2.0.tar.gz.
File metadata
- Download URL: tr_lang_py-0.2.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6862ef50590324804be84a6ef0c5a4d10a130f27f5ad69ea7c76041fd6518ab5
|
|
| MD5 |
ee571e97a3311da0abe272380673bf0d
|
|
| BLAKE2b-256 |
eca5455d678dc9aad6aa0471c14d53af8d00a63c94aa7d8205d902022e9480a7
|
File details
Details for the file tr_lang_py-0.2.0-cp38-cp38-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: tr_lang_py-0.2.0-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5920bc3b98496cccdcf56fda7f4f1cb1d97caf2491730fde89ed6adb186496c
|
|
| MD5 |
3365260202edb62c106bb02710cc223f
|
|
| BLAKE2b-256 |
08e273654e542bb7bfb704588422cfe642b4d35d773dd147c8b2d53022aa9828
|