Lua programming language written in Python
Project description
mehtap
Lua 5.4 programming language implementation in Pure Python
Status
mehtap is in an early alpha stage. Since there is active development, API changes may happen without any special notice. Please pin your dependencies using a specific commit hash.
Installation
mehtap is supported on Python 3.10+. First, make sure you have a Python environment set up.
# in the shell
poetry add mehtap # if using python-poetry.org
pipenv install mehtap # if using pipenv.pypa.io
pip install mehtap # straight pip.pypa.io
What does mehtap have?
-
Everything in the Lua 5.4 grammar is supported.
-
There are utility functions to convert values from Python to Lua and from Lua to Python.
-
Most of the standard library is supported. (100% support is planned.)
Basic Functions (25/25)
-
assert()
-
collectgarbage()
— Does nothing. -
dofile()
-
error()
-
_G
-
getmetatable()
-
ipairs()
-
load()
— No binary chunks, no upvalues and no _ENV. -
loadfile()
— seeload()
. -
next()
-
pairs()
-
pcall()
-
print()
-
rawequal()
-
rawget()
-
rawlen()
-
rawset()
-
select()
-
setmetatable()
-
tonumber()
-
tostring()
-
type()
-
_VERSION
-
warn()
-
xpcall()
Input and Output Facilities (18/18)
- io.close()
- io.flush()
- io.input()
- io.lines()
- io.open()
- io.output()
- io.popen()
- io.read()
- io.tmpfile()
- io.type()
- io.write()
- file:close()
- file:flush()
- file:lines()
- file:read()
- file:seek()
- file:setvbuf() — Does nothing.
- file:write()
Operating System Facilities (11/11)
- os.clock()
- os.date()
- os.difftime()
- os.execute()
- os.exit()
- os.getenv()
- os.remove()
- os.rename()
- os.setlocale()
- os.time()
- os.tmpname()
-
What's the catch?
There are some differences with the specification of the reference manual. They are:
- garbage collection,
- frame scope.
For the most part, behaviour differences with the reference implementation are only allowed if the reference manual does not specify the behaviour. For example, the exact formatting of error messages is not specified in the reference manual, so it is allowed to be different.
Also, since this is a Python implementation, it is SLOW.
Acknowledgements
I want to hereby thank the following people for their
(uninformed) contributions to the project:
(If you are reading this, hello! 👋)
- Blake Bourque for creating Lua by Example, a great resource for learning Lua which also serves in the test suite of mehtap.
- oatmealine for putting together this awesome gist explaining how metamethods and metavalues override operations in detail.
Copyright (c) 2024 Emre Özcan
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
Built Distribution
File details
Details for the file mehtap-0.1.3.tar.gz
.
File metadata
- Download URL: mehtap-0.1.3.tar.gz
- Upload date:
- Size: 50.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90debe34553c2d7ac7589c97764c7973008e53c581fe978139f2f2a10576840c |
|
MD5 | 0a974a9e213bf3b796d0b6dac27d2da5 |
|
BLAKE2b-256 | f6123d2b5d4db1b83967a3ed322faacd68c704b09f6f74e127ffa3f11b7119e4 |
Provenance
The following attestation bundles were made for mehtap-0.1.3.tar.gz
:
Publisher:
publish.yml
on emreozcan/mehtap
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mehtap-0.1.3.tar.gz
- Subject digest:
90debe34553c2d7ac7589c97764c7973008e53c581fe978139f2f2a10576840c
- Sigstore transparency entry: 151075054
- Sigstore integration time:
- Predicate type:
File details
Details for the file mehtap-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: mehtap-0.1.3-py3-none-any.whl
- Upload date:
- Size: 55.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9b1466ca1b112cfd77e69ee07206d08a8823ac6e0777d890e60efa1a23a2b8f |
|
MD5 | 9e1417b4fd3dda6037b57059e3cc3ed2 |
|
BLAKE2b-256 | 73e4a18f9754ee7239d9babd7acfd06bdcf5609a3923199662e30964b2258459 |
Provenance
The following attestation bundles were made for mehtap-0.1.3-py3-none-any.whl
:
Publisher:
publish.yml
on emreozcan/mehtap
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
mehtap-0.1.3-py3-none-any.whl
- Subject digest:
a9b1466ca1b112cfd77e69ee07206d08a8823ac6e0777d890e60efa1a23a2b8f
- Sigstore transparency entry: 151075055
- Sigstore integration time:
- Predicate type: