MiniD - Programming language

< >

MiniD is a programming language created in 2006 by Jarrett Billingsley.

 #274on PLDB 17Years Old 86Users 0Books 0Papers 0Repos

The MiniD (has been renamed Croc) programming language is a small, lightweight, extension language in the vein of Lua or Squirrel, but designed to be used mainly with the D programming language. It supports both object-oriented and imperative programming paradigms, as well as some simple functional aspects. Distributed under the licence of zlib/libpng, MiniD is free software.. Read more on Wikipedia...

Example from the web:
```module matrix local SIZE = 30 function mkmatrix(rows, cols) { local count = 1 local m = array.new(rows) for(i: 0 .. rows) { m[i] = array.new(cols) for(j: 0 .. cols) { ++count m[i][j] = count } } return m } function mmult(rows, cols, m1, m2, m3) { for(i: 0 .. rows) { for(j: 0 .. cols) { local val = 0 for(k: 0 .. cols) val += m1[i][k] * m2[k][j] m3[i][j] = val } } return m3 } function main(N) { local n = 1 if(isString(N)) n = toInt(N) local m1 = mkmatrix(SIZE, SIZE) local m2 = mkmatrix(SIZE, SIZE) local mm = mkmatrix(SIZE, SIZE) for(i: 0 .. n) mmult(SIZE, SIZE, m1, m2, mm) writefln(mm[0][0], " ", mm[2][3], " ", mm[3][2], " ", mm[4][4]) }```
Example from Wikipedia:
```function first(x: array|string) = x[0] writeln(first([1, 2, 3])) // prints 1 writeln(first("hello")) // prints h writeln(first(45)) // error, invalid parameter type 'int'```

Language features

Feature Supported Token Example
Binary Literals âœ“
`// 0[bB][01][01_]*`
Integers âœ“
`// ([0-9][0-9_]*)(?![.eE])`
Floats âœ“
`// ([0-9][0-9_]*)(?=[.eE])(\.[0-9][0-9_]*)?([eE][+\-]?[0-9_]+)?`
`// 0[xX][0-9a-fA-F][0-9a-fA-F_]*`
`// A comment`
`// A comment`