View mode: basic / threaded / horizontal-split · Log in · Help
January 01, 2011
Nimrod language
Through Reddit I have found a short discussion about the Nimrod language, it's a garbage collected statically typed language fit for low level coding too, despite it looks a lot like Python (with a bit of Pascal semantics added), it has generics too, templates, and macros, its compiler is written in Nimrod itself, and it compiles to C:
http://www.reddit.com/r/programming/comments/eub63/nimrod_programming_language/

I've seen that there's an older link to Nimrod in D newsgroups:
http://www.digitalmars.com/d/archives/digitalmars/D/Complete_off_topic_Nimrod_language_107212.html

The Nimrod site:
http://force7.de/nimrod/index.html

Two pages of tutorials (there is a manual too, elsewhere):
http://force7.de/nimrod/tut1.html
http://force7.de/nimrod/tut2.html
About AST macros:
http://force7.de/nimrod/macros.html

Here are some quotations and notes about the tutorials (version 0.8.10), the Reddit thread (and the manual), I show some Nimrod features:

-------------------

>Case is insignificant in Nimrod and even underscores are ignored: This_is_an_identifier and ThisIsAnIdentifier are the same identifier. This feature enables you to use other people's code without bothering about a naming convention that conflicts with yours. It also frees you from remembering the exact spelling of an identifier (was it parseURL or parseUrl or parse_URL?).<

So the "_" is not usable, and if you search for names in the code you need to set it to ignore underscores.

-------------------

>Comments are tokens; they are only allowed at certain places in the input file as they belong to the syntax tree! This feature enables perfect source-to-source transformations (such as pretty-printing) and superior documentation generators.<

-------------------

>Hexadecimal literals are prefixed with 0x, binary literals with 0b and octal literals with 0o. A leading zero alone does not produce an octal.<

-------------------

>To call a procedure that returns a value just for its side effects and ignoring its return value, a discard statement has to be used. Nimrod does not allow to silently throw away a return value:<

discard factorial(10)

-------------------

It has iterators with a syntax similar to Python:

iterator countup(a, b: int): int =
 var res = a
 while res <= b:
   yield res
   inc(res)

-------------------

There's a way to specify integer literals of the desired size, signed bytes too:

var
 x = 0     # x is of type ``int``
 y = 0'i8  # y is of type ``int8``
 z = 0'i64 # z is of type ``int64``

-------------------

>Automatic type conversion in expressions with different kinds of floating point types is performed: the smaller type is converted to the larger. Integer types are not converted to floating point types automatically and vice versa. The toInt and toFloat procs can be used for these conversions.<

-------------------

It has integral subranges (ranged types of Pascal, Ada):

type
 TSubrange = range[0..5]

-------------------

One of the compilation options is to turn on "hints" (there are warnings and errors too):

hints	on|off 	Turns the hint messages of the compiler on or off.

-------------------

Overall it looks like a quite nice language. I have not tried to program with it yet.

Bye,
bearophile
January 01, 2011
Re: Nimrod language
On Sat, 01 Jan 2011 13:00:15 -0500
>>>>>> "bearophile" == bearophile <bearophileHUGS@lycos.com> wrote:

bearophile> Through Reddit I have found a short discussion about the
bearophile> Nimrod language, it's a garbage collected statically typed
bearophile> language fit for low level coding too...

Happy New Year ;)

-- 

Gour  | Hlapicina, Croatia  | GPG key: CDBF17CA
----------------------------------------------------------------
January 01, 2011
Re: Nimrod language
bearophile wrote:
> Overall it looks like a quite nice language. I have not tried to program with it yet.
> 
	I have (actually, I believe that I  discovered Nimrod following one
of your posts here ;)). You can find some performance benchmarks
here: https://bitbucket.org/jmb/shootout/wiki/Home

	IMO the concept is interesting (especially the Python-like syntax
for a compiled language), but there are a lot of rough edges and
development is very slow.

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr
January 01, 2011
Re: Nimrod language
J. M. Berger:

> You can find some performance benchmarks
> here: https://bitbucket.org/jmb/shootout/wiki/Home

Thank you for the link, I will carefully read your Nimrod implementations.


> 	IMO the concept is interesting (especially the Python-like syntax
> for a compiled language),

There several other examples of the same thing (like the Python compiler I'm helping the development, ShedSkin), Boo, etc.


> but there are a lot of rough edges and development is very slow.

Nimrod seems to contain no new ideas, and probably some large ideas of D2 are missing, but the syntax and some smaller details are nice.

The authors of Nimrod seem kind of the opposite of this language designer that was famous in the Amiga scene. This person keeps trying to invent something sharply different from the languages we use today (and someday I think he will produce something very good):
http://strlen.com/programming-languages
http://strlen.com/language-design-overview

Bye,
bearophile
January 01, 2011
Re: Nimrod language
This language looks *very* interesting and sensibly designed. The author seems to have taken, in addition to much input from C-like languages and Python, the best of the Pascal line tradition. Also, he obviously "dared" getting rid of some legacy garbage. Unfortunately, not all, and took dome more. (Even reproduced "elif" and kept the stupid ':' of Python ;-).

On Sat, 01 Jan 2011 13:00:15 -0500
bearophile <bearophileHUGS@lycos.com> wrote:

> I show some Nimrod features [...]

From the tutorial:
"Parameters are constant in the procedure body. Their value cannot be changed because this allows the compiler to implement parameter passing in the most efficient way. If the procedure needs to modify the argument for the caller, a var parameter can be used"

Bravo! For me, the primary effect is not allowing optimisation, but that now "parameter" means parameter; so that one can reason about the code.


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com
January 01, 2011
Re: Nimrod language
spir:

> (Even reproduced "elif"

Python doesn't have the switch statement, so to write a switch you sometimes use a sequence of if statements, in this case "elif" helps keep the code more tidy:

x = 3
if x == 0:
   pass
elif x = 1:
   pass
else:
   pass


> and kept the stupid ':' of Python ;-).

It comes from usability studies on the ABC language. If you are going to use a Python-like syntax, then removing those ":" is stupid.


> "Parameters are constant in the procedure body. Their value cannot be changed because this allows the compiler to implement parameter passing in the most efficient way.

I have missed that part of the docs. What kind of "most efficient way"?

Bye,
bearophile
January 01, 2011
Re: Nimrod language
On 1/1/11 5:07 PM, bearophile wrote:
> J. M. Berger:
>
>> You can find some performance benchmarks
>> here: https://bitbucket.org/jmb/shootout/wiki/Home
>
> Thank you for the link, I will carefully read your Nimrod implementations.
>
>
>> 	IMO the concept is interesting (especially the Python-like syntax
>> for a compiled language),
>
> There several other examples of the same thing (like the Python compiler I'm helping the development, ShedSkin), Boo, etc.
>
>
>> but there are a lot of rough edges and development is very slow.
>
> Nimrod seems to contain no new ideas, and probably some large ideas of D2 are missing, but the syntax and some smaller details are nice.

My fantasy: bearophile goes to the Nimrod forum and says "Hey, how about 
this D language, seems interesting..." :o)

Andrei
January 02, 2011
Re: Nimrod language
bearophile wrote:
>> 	IMO the concept is interesting (especially the Python-like syntax
>> for a compiled language),
>
> There several other examples of the same thing (like the Python compiler I'm helping the development, ShedSkin), Boo, etc.
>
>
>> but there are a lot of rough edges and development is very slow.
>
> Nimrod seems to contain no new ideas, and probably some large ideas of D2 are missing, but the syntax and some smaller details are nice.


There's also http://delight.sourceforge.net/

It's based on GDC, with a Python-like syntax.

--anders
January 02, 2011
Re: Nimrod language
From that Reddit thread on Nimrod:

Andrei:

>Our initial plan with D2 was to include AST macros, but we decided to see how string mixins swim and defer macros to D3. The D forums are virtually silent on the topic of macros now, and it's definitely not because the community is being coy :o).<

You are right that lately no serious discussions have happened here about AST macros. But the causes are not coyness or because string mixins are good enough. I think the causes are:
- AST Macros a not a minor feature, they require some time and thinking to design them well, some syntax support, some code in the front-end, some documentation for users, and some time to learn to use them.
- D2 has many bugs and some unfinished parts. Most people here know that adding more features now is not right. And generally Walter and you are (rightly) adding major new features to D2 right now. Once D2 is more finished and debugged some discussions about AST macros may start again.
- Lot of people here probably are not experienced with AST macros.
- I like the idea of AST macros, they are powerful, but they add a significant amount of complexity to the language. So I am not pushing a lot for them, despite I almost hate string mixings and creating code with string snippets.

--------------------

kapilash :

>The forum I was referring to had too many useless discussions about the length of the word "immutable", unnecessary arguments about D vs other languages and far too much emphasis on reddit.<

I don't mark threads as this "Nimrod language" as OT because a new language like D2 must keep eyes open on other new languages and some computer science.

Bye,
bearophile
January 02, 2011
Re: Nimrod language
> And generally Walter and you are (rightly) adding major new features to D2 right now.

Sorry, I meant:

> And generally Walter and you are (rightly) against adding major new features to D2 right now.

Bye,
bearophile
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home