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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

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

Hashes for tr_lang_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6862ef50590324804be84a6ef0c5a4d10a130f27f5ad69ea7c76041fd6518ab5
MD5 ee571e97a3311da0abe272380673bf0d
BLAKE2b-256 eca5455d678dc9aad6aa0471c14d53af8d00a63c94aa7d8205d902022e9480a7

See more details on using hashes here.

File details

Details for the file tr_lang_py-0.2.0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tr_lang_py-0.2.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f5920bc3b98496cccdcf56fda7f4f1cb1d97caf2491730fde89ed6adb186496c
MD5 3365260202edb62c106bb02710cc223f
BLAKE2b-256 08e273654e542bb7bfb704588422cfe642b4d35d773dd147c8b2d53022aa9828

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