Skip to main content

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}")

Metadata

Release files for nimastpaser 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nimastpaser 1.0.1
File Size Uploaded
nimastpaser-1.0.1.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nimastpaser 1.0.1
File Interpreter ABI Platform
nimastpaser-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.3 kB

Release files / nimastpaser-1.0.1.tar.gz

Download URL nimastpaser-1.0.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1155e258439ec4fb3b3dc6adc182a295f0a6f2f1d18b9a77a099f8e3cf1e3634
BLAKE2b-256 checksum
How to use checksums
87f9b4bf866af1b582f7f312911a3b2a75996b42245657dac8cd8fdb54b67da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / nimastpaser-1.0.1-py3-none-any.whl

Download URL nimastpaser-1.0.1-py3-none-any.whl
Size 2.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2b9f79a94ea019222cd8c373c96a6e30786328a5c77db8070552c44fa68c4dd
BLAKE2b-256 checksum
How to use checksums
f80c334a60e5408e7020a82852f83d2ed16d2ca01644043fe830a8e3b04fda82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page