https://github.com/alehander92/hivemind
a multi-syntax language
https://github.com/alehander92/hivemind
compiler experiment language multi-syntax-language
Last synced: 5 months ago
JSON representation
a multi-syntax language
- Host: GitHub
- URL: https://github.com/alehander92/hivemind
- Owner: alehander92
- License: mit
- Created: 2015-04-24T13:47:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-03-13T09:32:20.000Z (over 10 years ago)
- Last Synced: 2026-01-13T07:29:16.799Z (5 months ago)
- Topics: compiler, experiment, language, multi-syntax-language
- Language: Ruby
- Homepage:
- Size: 47.9 KB
- Stars: 136
- Watchers: 9
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/alehander42/hivemind)
[](LICENSE)
# hivemind
A prototype of a multi-syntax programming language.
Hivemind has a core language defined by its AST and configurable syntaxes acting like plugins.
The concept of "syntax" for hivemind is similar to
* a theme for a text editor
* a skin for a gui app
* a json/html/xml template for a MVC web app
Syntaxes are defined using code-like examples for core ast nodes and they act in a bidirectional way:
* they are used to parse source code using that syntax
* and to render code in that syntax
* **source in each syntax is automatically transltable to another syntax**
Tools for the language would also support representations of source grouped by class or methods or as a graph
Syntaxes look like that:
A pythonic syntax:
```python
#if_statement
if :
else:
#assign
=
#call
(<>)
#attribute
.
#attribute_assign
. =
#binary
#list
[<>]
#method_statement
method (<>):
<>
#class_statement
class :
<>
#module_statement
module :
<>
```
A lisp-like syntax
```
#if_statement
(if
)
#assign
(define )
#method_statement
(method (<>)
<>)
#attribute
.
#attribute_assign
(update . )
#binary
( )
#call
(! <>)
#list
_(<>)
#class_statement
(class
<>)
#module_statement
(module
<>)
```
# Examples
[pythonic example](examples/shape_pythonic.hm)
[schemelike example](examples/shape_paren.hm)
# Installation
```
gem install hivemind
```
# Usage
Run a file
```bash
hivemind
```
Translate a file into another syntax representation
```bash
hivemind render a.hm pythonic a2.hm
```
# Goals
* Experiment with diffent syntaxes in different contexts
* Use different sub-language seamlessly across the same codebase
* A possible solution for the expression problem (just convert between different representations)
# Language
The core language is just a simple python/ruby-like language for now.
# History
Created for the HackFMI 5
# Future development
* fluid folder/file structure representations
* editor plugins
* more syntaxes
## License
Copyright 2016 [Alexander Ivanov](https://twitter.com/alehander42)
Distributed under the MIT License.