Skip to main content

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

tr-lang 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 hashes)

Uploaded Source

Built Distribution

tr_lang_py-0.2.0-cp38-cp38-manylinux_2_28_x86_64.whl (7.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

Supported by

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