5 ms·
Some very interesting features of Nimrod which I would like to emphasize: - clean Pythonic syntax (whitespace relevant but tabs are forbidden) - native Perl s
by progman 13y ago
Some very interesting features of Nimrod which I would like to emphasize:
- clean Pythonic syntax (whitespace relevant but tabs are forbidden)
- native Perl syntax for regular expressions (slide 42)
- subrange types as in Ada
- set types as in Pascal
- strings as case (switch) selectors
- easy C interface with automatic type conversion (only functions as parameters need additional compiler pragmas)
- typed macros (templates)
- object code: native, C, Javascript (probably more to come)
I am working with Nimrod right now, and it is really one of the most productive languages that I ever encountered. It seems to mix the best features of other popular languages. Nimrod actually is where Python should be. I wonder if it is suitable for small embedded systems also.
By the way, one important difference to Perl regular expressions is that re"..." always parses the whole expression where Perl parses partially. Fortunately Perl's behavior can easily be simulated with a template.
- TylerE 13y agoFor embedded use it's probably ok, anywhere C is ok. It statically links the bits of the stdlib you use but dead code elimination seems to work pretty well. A simple word counting script I just wrote compiles down to about 52k on 64bit OS X. (Src: https://gist.github.com/tylereaves/7711302 https://gist.github.com/tylereaves/7711302)
- progman 13y agoThanks - but your example is Python code ??
- TylerE 13y agoNo, it's Nimrod. I set it to python in gist because that's the closest to nimrod for syntax highlighting purposes. Edit: Apparenetly not...there are alot more modes in there but the UI exposing them is easy to miss
- flyinglizard 13y agoI also wonder about Nimrod on embedded. The dealbreaker is dynamic memory allocation; if Nimrod does that as a non-negotiable part of its runtime, it can't be used.
- jamesaguilar 13y agoIt looks like this might rely on the GC. From the description, you can cut that out too if you handle cleanup yourself. Not sure though.
- andrewflnr 13y agoWhat do you mean by "Nimrod is where Python should be"? The two languages are aimed at very different use cases.
- progman 13y agoNimrod provides the features which I wanted to have when I developed with Python: type system, Perl regex, range subtypes, easy C interface. native compiler(s). I know PyPy but Nimrod needs much less space to compile.
- hcarvalhoalves 13y ago> Nimrod actually is where Python should be. I guess you meant "what I wanted Python to be". I don't see how Nimrod is a natural evolution of Python. Static types and meta-programming by templates are far from anything Python proposes. I believe not even the syntax comparison applies too much, it's syntax is more reminiscent of Pascal than Python itself.
- TylerE 13y agoAs someone who has spent much of the last decade or so writing Python, I mostly disagree. The pain points I've had with python (speed, mainly) are well catered to by Nimrod. I agree that it's not "pythonic" in some ways, but the feeling is very similar. The wtfs/line ratio is very low.
- twotwotwo 13y ago> I am working with Nimrod right now Cool! Is what you're working on public?
- progman 13y agoNot yet. I am working on a replacement for the Asciidoc/Docbook toolchain which I am not satisfied with. It handles an extended version of Asciidoc and aims to produce code for a few output formats (HTML, TeX).
- mmfZ4e4OqQ7RRwP 13y agoNimrod includes rst parsing and html/tex generation (http://build.nimrod-lang.org/docs/rstgen.html http://build.nimrod-lang.org/docs/rstgen.html). While orthogonal to your quest you may want to look into its implementation for inspiration (or adopt rst instead of asciidoc for your publishing needs).
- progman 13y agoInteresting. I'll take a closer look at it.