Hyperglot A Language Experimentation Platform

Hyperglot aims to speed up the way you create and develop programming languages or DSLs. You specify a PEG grammar using Spidermonkey AST primitives and you get a compiler back. Simple as that.

To run a release of Hyperglot, you will need to have a node-webkit binary.

Projects

This is the view presented to you when you launch Hyperglot.

On the left you have projects you have created. These will be ordered on the basis of most recently modified. To remove a project, simply click the cross to the right of it's name.

On the right you have the most recent commits to the public repository. Selecting any of these commits will open your browser with said commit info.

Overview

Syntax Pane

The syntax pane is where you specify the grammar of your language. It is based around David Majda's excellent PEG.js, a parser generator. For the syntax of PEG.js, please read it's documentation.

PEG.js is great, but to shortcut the time it takes to get a AST up and going, you can access a variable called ast with node type functions as properties. This object follows the Mozilla Spidermonkey Parser API.

As an example, take the following syntax which specifies an Identifier node:

Identifier = c:[A-Za-z]+ { return ast.identifier(c.join('')); }

During the writing of your grammar, the bottom bar will notify you of any errors generated by PEG.js. It will also tell you when your parser has been created.

Overview

Input Pane

The input pane is where you write the source code of your language. If your parser was successfully generated using the Syntax pane, any source language you input into the editor will be parsed by the parser you generated. If the source was successfully parsed the lower status message area will tell you so, and you should move to the Output Pane. If it failed to parse, you will be told so.

Overview

Output Pane

If your custom language was parsed successfully, the AST will appear on the left. If you used the right combination of AST nodes in your tree, Escodegen will have successfully transformed your AST into EcmaScript. Congratulations, you've built a language!

If for some reason it didn't generate source for your input source language, then it's because the wrong types of expressions / statements were used and you need to rework your AST.

Overview

Decode Pane

In the decode pane you can input some EcmaScript and get the AST representation of the code you input thanks to Esprima. Good for determining what kind of AST a particular feature of your lanugage might need to emit.

Overview

Export Pane

The export pane turns your PEG into a fully-fledged compiler using the very tools used by Hyperglot. Right now it's a proof-of-concept with just the basic functionality. For more details, generate a compiler and look at the source of hgc

Overview

Get Involved

If you have feedback, please create a new Issue on GitHub or review existing issues. Pull requests are welcome.

Overview

Credits

Without the following libraries and projects, Hyperglot would not be possible:

Overview

License

The Modified MIT License (MIT)

Copyright (c) 2013 Tristan McNab (@tmcnab)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without limitation the rights to use, copy, modify, merge, publish, and distribute, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note: the above is a modified MIT licence. Changes are that you can't sell or relicence Hyperglot. Everything else is fine though!

Overview