Thanks to Andrzej Rutkowski for designing this logo.

It's MiniD!

Table of Contents

  1. What's MiniD?
  2. Announcements and Communication
  3. Language Documentation
  4. Language Tutorial
  5. Cookbook
  6. Library Documentation
  7. Library Tutorial
  8. Try it out!
  9. Other Downloads
  10. Addon Libraries

MiniD is not dead!

I am still developing it, despite my recent departure from the D community. Please don't give up on me :3

What's MiniD?

MiniD is a scripting language which was conceived, written, and is maintained by Jarrett Billingsley. It is most closely related to Lua, with other influences from D, Squirrel, and Io and is dynamically typed with a C-style syntax and D-like (though not identical to D) semantics.

MiniD is not an "interpreted version of D" or anything like that, despite what the ill-fitting name implies. It's a language all on its own, with its own grammar and semantics. If you're familiar with D, though, there should be a lot here that will seem familiar to you.

The reference implementation is written in D and is designed with D's featureset in mind, in order to make integration of MiniD into a host application seamless and easy.

Announcements and Communication

MiniD 2 has been released! The spec is frozen, and any changes to it will be done in a new repository branch.

You can find announcements and status updates, ask questions, and discuss the language over on the forums. Please feel free to start your own topics!

There's also an IRC channel for MiniD on Freenode, called #d.minid. You can access that link if your browser understands irc:// links. I (Jarrett) try to be on as much as possible.

If you have a suggestion or bug report, please use the "New Ticket" button at the top right.

Language Documentation

MiniD as a language is not tied to any specific implementation. The reference implementation is written in D, but anyone is free to implement the language any way they choose.

  • Introduction
  • MiniD 2 Specification
    • Compilation - Describes the process of compiling source text into an executable form.
    • Execution - How the compiled MiniD code is actually run.
    • Lexical - The very basic textual bits that the language is made up of.
    • Expressions - The algebraic language syntax of MiniD.
    • Statements - Various language constructs.
    • Types - A description of the various data types in MiniD.
    • Declarations - How one declares and initializes variables.
    • Functions - How to declare functions and what they can do.
    • Classes - The object-oriented aspects of MiniD.
    • Modules - The largest blocks of organization in MiniD, and how to work with them.
    • Metamethods - How to customize the behavior of objects and perform operator overloading.
    • Grammar - The (mostly-correct) EBNF grammar for MiniD.
  • Standard Library - A library of common operations that accompanies MiniD.
    • Base Library - A set of simple/common functionality that doesn't fit anywhere else.
      • Modules Library - A subset of the base library that holds the functions and structures necessary for the MiniD module system.
      • Thread Library - A subset of the base library that has to do with threading and thread objects.
      • GC Library - A subset of the base library that lets you query and control the garbage collector.
    • Array Library - A library of common array functions.
    • Character Library - Character classification and modification.
    • Debug Library - Functions for getting debugging info from within MiniD.
    • Hash Library - Operations that are mostly applicable to both hash types: tables and namespaces.
    • IO Library - File system manipulations and file access.
    • Math Library - Regular old math functions.
    • OS Library - Access to some lower-level OS functionality, like spawning processes.
    • RegExp Library - String manipulation and matching with regular expressions.
    • Stream Library - Classes for performing streamed input and output.
    • String Library - Functions for manipulating strings.
    • Time Library - For timing things and getting the system time.

Language Tutorial

This is an informal introduction to the language, bit by bit. It assumes that you already know a good bit about programming and are comfortable using command-line programs.

  • Getting Started - Obligatory programs and such.
  • Types - Many of the MiniD types and what you can do with them.
  • Expressions - The various value-yielding language constructs.
  • Statements - Control flow, assignment, and variable declarations.
  • Functions - Breaking up your program into individual reusable bits.
  • Classes - Defining your own types.
  • Metamethods - Making your types work like built-in types.
  • Exceptions - How MiniD handles errors - neatly.
  • Modules - Organizing larger programs.
  • Coroutines - Fun with collaborative multithreading!
  • Decorators - A simple but flexible way to customize declarations.
  • Advanced Topics - Weak references, custom module loaders, iteration fun, applications...
  • Standard Library? - A broad overview of some of the more important parts of the standard library.

Cookbook

This should hopefully be a repository of small snippets of code and design patterns, organized by "how do I...?" sort of questions. Choose a category to see what snippets are available for that area of the language.

  • Metaprogramming - How your programs can find things out about themselves and generate new code
  • Classes - Tips on using classes, instances, object-oriented stuff
  • Coroutines? - Using coroutines for fun and profit
  • Syntactic Sugar? - Various bits of sugar and shortcuts you can use to make your code terser

Library Documentation

This is the documentation for the reference library implementation of MiniD.

Installation

For instructions on installing MiniD, follow this link.

The MiniD 2 Library Reference follows:

  • Compilation Options - Customize your build of MiniD for different restrictions and capabilities.
  • minid.alloc - No real public interface, but it does define and explain the memory allocation function type that MiniD uses to perform all its memory allocation. See minid.api for where it's used.
  • minid.api - The main file you should import when using MiniD, this defines a few core functions and publicly imports most of the rest of the public API.
  • minid.ast - This module holds the definitions of all the abstract syntax tree (AST) nodes used by the MiniD compiler. When the compiler gets the ability to provide you with an AST of some code, you'll be able to access all the members of these nodes.
  • minid.bind - The binding library, which allows you to quickly exposts native D types and functions to MiniD (not complete yet).
  • minid.commandline - A MiniD command-line interpreter which contains all the logic needed to embed a simple CLI in your app. MDCL basically just wraps this.
  • minid.compiler - This module holds the public interface to the compiler. Most of the time you won't need to deal with this.
  • minid.ex - The "extension" library, a collection of non-essential but useful functionality to automate many common native API tasks such as building strings, checking parameters, and looking up dotted names.
  • minid.interpreter - The vast majority of the MiniD API lies in here.
  • minid.serialization - The APIs for serializing and deserializing compiled MiniD functions.
  • minid.types - Type declarations used by the API, as well as some other variables and constants.
  • minid.utils - A utility library with a bunch of non-MiniD-specific functionality.
  • minid.vm - A module with a few VM-related functions.

Library Tutorial

This is an informal introduction to using the native API. It assumes that you more or less know how to program in MiniD.

  • Introduction - An overview of the basic concepts used throughout the native API.
  • Part 1 - Setting up the host app and compiling and running code.
  • Part 2 - Exchanging basic values between native and script code.
  • Part 3 - Calling things from native code and creating native closures.
  • Part 4 - Handling errors.
  • Part 5 - Making a native class.
  • Part 6? - Using coroutines.
  • Part 7? - Making a native module.
  • Part 8 - Using the binding library.
  • Part 9? - Random fun stuff.

Try it out!

The MiniD distribution comes with a command-line interpreter called MDCL. MDCL can be run in interactive mode (type the code in and it's run immediately), or it can be just run to execute a script file. Because MiniD allows for the Unix-style shebang (#!) at the beginning of scripts, you can use MDCL as the scripting host for MiniD scripts (by putting "#!/path/to/mdcl" as the first line).

You can get both the Windows and Linux (both are 32-bit) executables of MDCL here. The Linux version of MDCL is compiled with readline support, so you must have libreadline and libhistory installed.

Other Downloads

Here are some syntax highlighters for code editors:

  • MiniD 1/2 Highlighter for vim. Installation: copy the file to ~/.vim/syntax (if those dirs don't exist, create them). Then in ~/.vim/filetype.vim (again, if it doesn't exist, create it), add:
    augroup filetypedetect
    au BufNewFile,BufRead *.md setf minid
    augroup END
    
  • MiniD 1 Highlighter for gedit. Installation: copy the file to /usr/share/gtksourceview-2.0/language-specs/ as root to use it. Gedit must be restarted for the change to take effect. Then, the MiniD option will appear under View > Highlight Mode > Scripts. It has to be manually selected because Gedit wants to determine highlight according to "mimetype" instead of file extension, it seems.
  • MiniD 2 Highlighter for ConTEXT. Installation: place in \YourConTEXTDir\Highlighters and restart ConTEXT. It's registered with the .md extension.
  • MiniD Highlighter for Kate. Installation: copy the file to ~/.kde/share/apps/katepart/syntax/ and it should just work.

Addon Libraries

The standard libraries that come with MiniD are useful for basic tasks, but sometimes you just need more power. This is what addon libraries are for. They're meant to be (mostly) standalone libraries which can be loaded into MiniD to provide extra functionality. These libraries are designed with both performance and integration with the standard libraries in mind.

Installation

For instructions on installing the addons, follow this link.

  • PCRE Library - A binding to the popular libpcre library, which lets you use powerful Perl-Compatible regexes.
  • SDL Library - A binding to SDL, the Simple Direct-media Layer, useful for setting up windows for multimedia apps in a cross-platform way. Still a work in progress.
  • GL Library - A binding to OpenGL. Works with the above SDL library, but you can use whatever you want to set up your GL contexts. Still a work in progress but mostly complete.
  • Net Library - A library providing basic socket-based networking support. Still very much a work in progress.