Python Package made by Mhadhbi Issam .
Project description
nimastparser
Python Library to parse and unparse nim code into ast tree .
Getting started
Install
pip install nimastparser
Usage :
Note : nim Compiler must be installed on your machine .
from nimastparser import nim
code = '''
let value = 2
case value
of 1:
echo "Value is one"
of 2:
echo "Value is two"
of 3, 4:
echo "Value is three or four"
else:
echo "Value is something else"
'''
# nim = None , get nim path from system using whcih nim
# otherwise nim = path/to/nim
tree = nim.parse(code=code , nim = None )
print(f"Ast Tree :\n{tree}")
# nim = None , get nim path from system using whcih nim
# otherwise nim = path/to/nim
generated_code = nim.unparse(code=tree , nim = None )
print(f"Converted code from Tree :\n{generated_codetree}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nimastpaser-1.0.1.tar.gz
(3.0 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 nimastpaser-1.0.1.tar.gz.
File metadata
- Download URL: nimastpaser-1.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1155e258439ec4fb3b3dc6adc182a295f0a6f2f1d18b9a77a099f8e3cf1e3634
|
|
| MD5 |
794d020462b45dbab984a5c0116bb4dd
|
|
| BLAKE2b-256 |
87f9b4bf866af1b582f7f312911a3b2a75996b42245657dac8cd8fdb54b67da0
|
File details
Details for the file nimastpaser-1.0.1-py3-none-any.whl.
File metadata
- Download URL: nimastpaser-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2b9f79a94ea019222cd8c373c96a6e30786328a5c77db8070552c44fa68c4dd
|
|
| MD5 |
709fbac6ed613031edb31b123841891f
|
|
| BLAKE2b-256 |
f80c334a60e5408e7020a82852f83d2ed16d2ca01644043fe830a8e3b04fda82
|