| 12 | | {{{ |
|---|
| 13 | | #!html |
|---|
| 14 | | <div style="border: grey 2px dashed; background: #AAFFAA; padding-left: 10px;"> |
|---|
| 15 | | <h2 style="padding-left: 20px">MiniD is not dead!</h2> |
|---|
| 16 | | }}} |
|---|
| 17 | | I am still developing it, despite my recent departure from the D community. Please don't give up on me :3 |
|---|
| 18 | | {{{ |
|---|
| 19 | | #!html |
|---|
| 20 | | </div> |
|---|
| 21 | | }}} |
|---|
| 22 | | |
|---|
| 23 | | == What's MiniD? == |
|---|
| 24 | | |
|---|
| 25 | | 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. |
|---|
| 26 | | |
|---|
| 27 | | 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. |
|---|
| 28 | | |
|---|
| 29 | | 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. |
|---|
| 30 | | |
|---|
| 31 | | == Announcements and Communication == |
|---|
| 32 | | |
|---|
| 33 | | '''MiniD 2''' has been released! The spec is frozen, and any changes to it will be done in a new repository branch. |
|---|
| 34 | | |
|---|
| 35 | | You can find announcements and status updates, ask questions, and discuss the language over on [http://www.dsource.org/forums/viewforum.php?f=94 the forums]. Please feel free to start your own topics! |
|---|
| 36 | | |
|---|
| 37 | | There's also an IRC channel for MiniD on Freenode, called [irc://chat.freenode.net/d.minid #d.minid]. You can access that link if your browser understands {{{irc://}}} links. I (Jarrett) try to be on as much as possible. |
|---|
| 38 | | |
|---|
| 39 | | If you have a suggestion or bug report, please use the "New Ticket" button at the top right. |
|---|
| 40 | | |
|---|
| 41 | | == Language Documentation == |
|---|
| 42 | | |
|---|
| 43 | | 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. |
|---|
| 44 | | |
|---|
| 45 | | * [wiki:Introduction2 Introduction] |
|---|
| 46 | | * MiniD 2 Specification |
|---|
| 47 | | * [wiki:LanguageSpec2/Compilation Compilation] - Describes the process of compiling source text into an executable form. |
|---|
| 48 | | * [wiki:LanguageSpec2/Execution Execution] - How the compiled MiniD code is actually run. |
|---|
| 49 | | * [wiki:LanguageSpec2/Lexical Lexical] - The very basic textual bits that the language is made up of. |
|---|
| 50 | | * [wiki:LanguageSpec2/Expressions Expressions] - The algebraic language syntax of MiniD. |
|---|
| 51 | | * [wiki:LanguageSpec2/Statements Statements] - Various language constructs. |
|---|
| 52 | | * [wiki:LanguageSpec2/Types Types] - A description of the various data types in MiniD. |
|---|
| 53 | | * [wiki:LanguageSpec2/Decls Declarations] - How one declares and initializes variables. |
|---|
| 54 | | * [wiki:LanguageSpec2/Functions Functions] - How to declare functions and what they can do. |
|---|
| 55 | | * [wiki:LanguageSpec2/Classes Classes] - The object-oriented aspects of MiniD. |
|---|
| 56 | | * [wiki:LanguageSpec2/Modules Modules] - The largest blocks of organization in MiniD, and how to work with them. |
|---|
| 57 | | * [wiki:LanguageSpec2/Metamethods Metamethods] - How to customize the behavior of objects and perform operator overloading. |
|---|
| 58 | | * [wiki:LanguageSpec2/MiniDGrammar Grammar] - The (mostly-correct) EBNF grammar for MiniD. |
|---|
| 59 | | * [wiki:StdLib2/Intro Standard Library] - A library of common operations that accompanies MiniD. |
|---|
| 60 | | * [wiki:StdLib2/BaseLib Base Library] - A set of simple/common functionality that doesn't fit anywhere else. |
|---|
| 61 | | * [wiki:StdLib2/ModuleLib Modules Library] - A subset of the base library that holds the functions and structures necessary for the MiniD module system. |
|---|
| 62 | | * [wiki:StdLib2/ThreadLib Thread Library] - A subset of the base library that has to do with threading and thread objects. |
|---|
| 63 | | * [wiki:StdLib2/GcLib GC Library] - A subset of the base library that lets you query and control the garbage collector. |
|---|
| 64 | | * [wiki:StdLib2/ArrayLib Array Library] - A library of common array functions. |
|---|
| 65 | | * [wiki:StdLib2/CharLib Character Library] - Character classification and modification. |
|---|
| 66 | | * [wiki:StdLib2/DebugLib Debug Library] - Functions for getting debugging info from within MiniD. |
|---|
| 67 | | * [wiki:StdLib2/HashLib Hash Library] - Operations that are mostly applicable to both hash types: tables and namespaces. |
|---|
| 68 | | * [wiki:StdLib2/IOLib IO Library] - File system manipulations and file access. |
|---|
| 69 | | * [wiki:StdLib2/MathLib Math Library] - Regular old math functions. |
|---|
| 70 | | * [wiki:StdLib2/OSLib OS Library] - Access to some lower-level OS functionality, like spawning processes. |
|---|
| 71 | | * [wiki:StdLib2/RegExp RegExp Library] - String manipulation and matching with regular expressions. |
|---|
| 72 | | * [wiki:StdLib2/StreamLib Stream Library] - Classes for performing streamed input and output. |
|---|
| 73 | | * [wiki:StdLib2/StringLib String Library] - Functions for manipulating strings. |
|---|
| 74 | | * [wiki:StdLib2/TimeLib Time Library] - For timing things and getting the system time. |
|---|
| 75 | | |
|---|
| 76 | | == Language Tutorial == |
|---|
| 77 | | |
|---|
| 78 | | 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. |
|---|
| 79 | | |
|---|
| 80 | | * [wiki:Lang/GettingStarted Getting Started] - Obligatory programs and such. |
|---|
| 81 | | * [wiki:Lang/Types Types] - Many of the MiniD types and what you can do with them. |
|---|
| 82 | | * [wiki:Lang/Expressions Expressions] - The various value-yielding language constructs. |
|---|
| 83 | | * [wiki:Lang/Statements Statements] - Control flow, assignment, and variable declarations. |
|---|
| 84 | | * [wiki:Lang/Functions Functions] - Breaking up your program into individual reusable bits. |
|---|
| 85 | | * [wiki:Lang/Classes Classes] - Defining your own types. |
|---|
| 86 | | * [wiki:Lang/Metamethods Metamethods] - Making your types work like built-in types. |
|---|
| 87 | | * [wiki:Lang/Exceptions Exceptions] - How MiniD handles errors - neatly. |
|---|
| 88 | | * [wiki:Lang/Modules Modules] - Organizing larger programs. |
|---|
| 89 | | * [wiki:Lang/Coroutines Coroutines] - Fun with collaborative multithreading! |
|---|
| 90 | | * [wiki:Lang/Decorators Decorators] - A simple but flexible way to customize declarations. |
|---|
| 91 | | * [wiki:Lang/Advanced Advanced Topics] - Weak references, custom module loaders, iteration fun, applications... |
|---|
| 92 | | * [wiki:Lang/Stdlib Standard Library] - A broad overview of some of the more important parts of the standard library. |
|---|
| 93 | | |
|---|
| 94 | | == Cookbook == |
|---|
| 95 | | |
|---|
| 96 | | 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. |
|---|
| 97 | | |
|---|
| 98 | | * [wiki:Cookbook/Metaprogramming Metaprogramming] - How your programs can find things out about themselves and generate new code |
|---|
| 99 | | * [wiki:Cookbook/Classes Classes] - Tips on using classes, instances, object-oriented stuff |
|---|
| 100 | | * [wiki:Cookbook/Coroutines Coroutines] - Using coroutines for fun and profit |
|---|
| 101 | | * [wiki:Cookbook/Sugar Syntactic Sugar] - Various bits of sugar and shortcuts you can use to make your code terser |
|---|
| 102 | | |
|---|
| 103 | | == Library Documentation == |
|---|
| 104 | | |
|---|
| 105 | | This is the documentation for the reference library implementation of MiniD. |
|---|
| 106 | | |
|---|
| 107 | | {{{ |
|---|
| 108 | | #!html |
|---|
| 109 | | <div style="border: grey 2px dashed; background: #FFDDAA; padding-left: 10px;"> |
|---|
| 110 | | <h2 style="padding-left: 20px">Installation</h2> |
|---|
| 111 | | }}} |
|---|
| 112 | | '''For instructions on installing MiniD, [wiki:Installation follow this link].''' |
|---|
| 113 | | {{{ |
|---|
| 114 | | #!html |
|---|
| 115 | | </div> |
|---|
| 116 | | }}} |
|---|
| 117 | | |
|---|
| 118 | | The MiniD 2 Library Reference follows: |
|---|
| 119 | | |
|---|
| 120 | | * [wiki:API2/CompilationOptions Compilation Options] - Customize your build of MiniD for different restrictions and capabilities. |
|---|
| 121 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.alloc.html 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. |
|---|
| 122 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.api.html 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. |
|---|
| 123 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.ast.html 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. |
|---|
| 124 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.bind.html minid.bind] - The binding library, which allows you to quickly exposts native D types and functions to MiniD '''(not complete yet)'''. |
|---|
| 125 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.commandline.html 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. |
|---|
| 126 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.compiler.html minid.compiler] - This module holds the public interface to the compiler. Most of the time you won't need to deal with this. |
|---|
| 127 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.ex.html 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. |
|---|
| 128 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.interpreter.html minid.interpreter] - The vast majority of the MiniD API lies in here. |
|---|
| 129 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.serialization.html minid.serialization] - The APIs for serializing and deserializing compiled MiniD functions. |
|---|
| 130 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.types.html minid.types] - Type declarations used by the API, as well as some other variables and constants. |
|---|
| 131 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.utils.html minid.utils] - A utility library with a bunch of non-MiniD-specific functionality. |
|---|
| 132 | | * [http://svn.dsource.org/projects/minid/trunk/docs/minid.vm.html minid.vm] - A module with a few VM-related functions. |
|---|
| 133 | | |
|---|
| 134 | | == Library Tutorial == |
|---|
| 135 | | |
|---|
| 136 | | This is an informal introduction to using the native API. It assumes that you more or less know how to program in MiniD. |
|---|
| 137 | | |
|---|
| 138 | | * [wiki:API2/Introduction Introduction] - An overview of the basic concepts used throughout the native API. |
|---|
| 139 | | * [wiki:API2/Part1 Part 1] - Setting up the host app and compiling and running code. |
|---|
| 140 | | * [wiki:API2/Part2 Part 2] - Exchanging basic values between native and script code. |
|---|
| 141 | | * [wiki:API2/Part3 Part 3] - Calling things from native code and creating native closures. |
|---|
| 142 | | * [wiki:API2/Part4 Part 4] - Handling errors. |
|---|
| 143 | | * [wiki:API2/Part5 Part 5] - Making a native class. |
|---|
| 144 | | * [wiki:API2/Part6 Part 6] - Using coroutines. |
|---|
| 145 | | * [wiki:API2/Part7 Part 7] - Making a native module. |
|---|
| 146 | | * [wiki:API2/Part8 Part 8] - Using the binding library. |
|---|
| 147 | | * [wiki:API2/Part9 Part 9] - Random fun stuff. |
|---|
| 148 | | |
|---|
| 149 | | == Try it out! == |
|---|
| 150 | | |
|---|
| 151 | | 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). |
|---|
| 152 | | |
|---|
| 153 | | You can get both the Windows and Linux (both are 32-bit) executables of MDCL [http://svn.dsource.org/projects/minid/trunk/mdcl.zip here]. The Linux version of MDCL is compiled with readline support, so you must have libreadline and libhistory installed. |
|---|
| 154 | | |
|---|
| 155 | | == Other Downloads == |
|---|
| 156 | | |
|---|
| 157 | | Here are some syntax highlighters for code editors: |
|---|
| 158 | | |
|---|
| 159 | | * [http://svn.dsource.org/projects/minid/downloads/minid.vim 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: |
|---|
| 160 | | {{{ |
|---|
| 161 | | augroup filetypedetect |
|---|
| 162 | | au BufNewFile,BufRead *.md setf minid |
|---|
| 163 | | augroup END |
|---|
| 164 | | }}} |
|---|
| 165 | | * [http://svn.dsource.org/projects/minid/downloads/minid.lang 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. |
|---|
| 166 | | * [http://svn.dsource.org/projects/minid/downloads/MiniD2.chl MiniD 2 Highlighter for ConTEXT]. Installation: place in \YourConTEXTDir\Highlighters and restart ConTEXT. It's registered with the .md extension. |
|---|
| 167 | | * [http://svn.dsource.org/projects/minid/downloads/minid.xml MiniD Highlighter for Kate]. Installation: copy the file to ~/.kde/share/apps/katepart/syntax/ and it should just work. |
|---|
| 168 | | |
|---|
| 169 | | == Addon Libraries == |
|---|
| 170 | | |
|---|
| 171 | | 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. |
|---|
| 172 | | |
|---|
| 173 | | {{{ |
|---|
| 174 | | #!html |
|---|
| 175 | | <div style="border: grey 2px dashed; background: #FFDDAA; padding-left: 10px;"> |
|---|
| 176 | | <h2 style="padding-left: 20px">Installation</h2> |
|---|
| 177 | | }}} |
|---|
| 178 | | '''For instructions on installing the addons, [wiki:Addons/Installation follow this link].''' |
|---|
| 179 | | {{{ |
|---|
| 180 | | #!html |
|---|
| 181 | | </div> |
|---|
| 182 | | }}} |
|---|
| 183 | | |
|---|
| 184 | | * [wiki:Addons/PcreLib PCRE Library] - A binding to the popular libpcre library, which lets you use powerful Perl-Compatible regexes. |
|---|
| 185 | | * [wiki:Addons/SdlLib 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.''' |
|---|
| 186 | | * [wiki:Addons/GlLib 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. |
|---|
| 187 | | * [wiki:Addons/NetLib Net Library] - A library providing basic socket-based networking support. '''Still very much a work in progress.''' |
|---|
| | 5 | Many thanks to Brad Anderson for graciously hosting this project and the dozens of others for free for years. |