Nim: embedded scripting

Created on 25 Sep 2019  路  1Comment  路  Source: nim-lang/Nim

Summary

golang uses a package system which contains all sorts of features. One feature I like is embedded lua and embedded tcl. There are many other languages but these are the simplest by far. I think NIM as an embedded lang could be awesome.

Description

This is not a problem per-say and while some might call it eating your own dogfood it's not at all. I have been looking for a language syntax that could be embedded in baser language as a scripting language... (running javascript from javascript is kinda the idea but the wrong syntax and runtime)

I suppose it would be interesting to get nim scripted/interpreted to run on nim. The syntax is more modern and complete than tcl and lua. And if you did it for golang you might get additional interest. The go people like those cross compilers. (GOOS, GOARCH, and so on)

Alternatives

I am using tcl and lua as part of a custom report generator. Both systems have complicated internals even though the languages are concise. Lua uses push/pop type stack approach, tcl is implemented as picol and while it's only about 500LOC it's missing some key primitives like lindex but worse the special case of structures like {...}

Additional Information

https://github.com/golang/go/wiki/Projects

https://github.com/Shopify/go-lua

https://github.com/golang/go/wiki/Projects#virtual-machines-and-languages

Feature Nimscript

Most helpful comment

The nimble pkg manager config files (pkgname.nimble) already are nimscipt. nim e filename executes the file as nimscript.
For more complex use case you can use the VM through the compiler api. examples: https://github.com/nim-lang/Nim/tree/devel/tests/compilerapi, https://github.com/zacharycarter/embeddedNimScript

>All comments

The nimble pkg manager config files (pkgname.nimble) already are nimscipt. nim e filename executes the file as nimscript.
For more complex use case you can use the VM through the compiler api. examples: https://github.com/nim-lang/Nim/tree/devel/tests/compilerapi, https://github.com/zacharycarter/embeddedNimScript

Was this page helpful?
0 / 5 - 0 ratings