PLDB
Languages Features Calendar CSV Lists Blog About Donate Add Language
GitHub icon

Nemerle

< >

Nemerle is a programming language created in 2003.

#197on PLDB 20Years Old 406Users
0Books 0Papers 177Repos

Nemerle is a general-purpose high-level statically typed programming language designed for platforms using the Common Language Infrastructure (.NET/Mono). It offers functional, object-oriented (OO) and imperative features. It has a simple C#-like syntax and a powerful metaprogramming system. Read more on Wikipedia...


Example from hello-world:
class Hello { static Main () : void { System.Console.WriteLine ("Hello World"); } }
// Hello World in Nemerle (a functional programming language for .NET) System.Console.WriteLine("Hello World");
Example from Linguist:
using System.Console; module Program { Main() : void { WriteLine("Hello world"); } }
Example from Wikipedia:
using System; using System.Runtime.InteropServices; class PlatformInvokeTest { [DllImport("msvcrt.dll")] public extern static puts(c : string) : int; [DllImport("msvcrt.dll")] internal extern static _flushall() : int; public static Main() : void { _ = puts("Test"); _ = _flushall(); } }

Language features

Feature Supported Token Example
Strings "
"Hello world"
Print() Debugging System.Console.WriteLine
Line Comments //
// A comment
Units of Measure
def m3 = 1 g;
def m4 = Si.Mass(m1);

WriteLine($"Mass in SI: $m4, in CGS: $m3");

def x1 = Si.Area(1 cm * 10 m);

WriteLine($"Area of 1 cm * 10 m = $x1 m");
Type Inference
Macros
// http://nemerle.org/About
def title = "Programming language authors";
def authors = ["Anders Hejlsberg", "Simon Peyton-Jones"];
    
// 'xml' - macro from Nemerle.Xml.Macro library which alows to inline XML literals into the nemerle-code
def html = xml <#
  
    
      $title
    
    
      
  • $author
#> Trace.Assert(html.GetType().Equals(typeof(XElement))); WriteLine(html.GetType());
Semantic Indentation
Comments
hy.html · nemerle.html · slim-lang.html

View source

PLDB - Build the next great programming language · v2023 · Day 153 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com