-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.md
66 lines (36 loc) · 1.73 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Nim4Python
- [Nim](http://nim-lang.org) Interoperability for Python.
A programming language embedded inside a programming language, installable via PIP. Pull Requests welcome.
![](example.png)
# Install
- `pip install nim4py==0c42da8`
# Use
```console
$ echo 'echo "NimScript embedded on Python"' > file.nims
$ python
Python 3.8.5 (default, May 17 2020, 18:15:42) [GCC 10.1.0] on linux
>>> from nimscript4python import nimscript
>>> nimscript("file.nims", ["/home/juan/.choosenim/toolchains/nim-1.3.5/lib/"])
NimScript embedded on Python
>>>
```
[![](https://raw.githubusercontent.com/juancarlospaco/nimscript4python/master/temp.png)](https://www.youtube.com/watch?v=BdQkU_HepIg)
# Requisites
- [Nim](http://nim-lang.org) `1.3.5` or newer,
[you can install it using choosenim_install directly from PIP.](https://github.com/juancarlospaco/choosenim_install#choosenim-integration-for-python-pip)
## TODO
- Return back directly from Nim to Python.
## FAQ
- Why ?.
It can be useful for some cool ideas, on Nim you do not have GIL, Garbage Collector, Virtual Machine, etc
but adds code execution at compile-time, powerful metaprogramming, you can "import" C/C++/JS Code and more,
maybe for plugins for a Python project or embedded scripting or similar ideas,
with option to compile to machine code binary or run in the browser or WebAssembly.
- What works of NimScript inside Python ?.
Everything if you pass **all** the standard library folder paths (?).
- Fails to find the NimScript file ?.
Use full path to the `.nims` file, it wont expand stuff like `~`, etc.
- Fails to find the stdlib folder ?.
Use full path to the stdlib folder, it wont expand stuff like `~`, etc.
- Whats NimScript ?.
https://nim-lang.github.io/Nim/nims.html