• Stars
    star
    134
  • Rank 262,020 (Top 6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a multi-syntax language

Build Status MIT 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:

#if_statement
if <test>:
    <true_branch>
else:
    <else_branch>

#assign
<left> = <right>

#call
<function>(<<args:', '>>)

#attribute
<object>.<label>

#attribute_assign
<object>.<label> = <right>

#binary
<left> <operation> <right>

#list
[<<elements:', '>>]

#method_statement
method <method_name>(<<args:', '>>):
    <<body>>

#class_statement
class <class_name>:
    <<methods:''>>

#module_statement
module <module_name>:
    <<elements>>

A lisp-like syntax

#if_statement
(if <test>
    <true_branch>
    <else_branch>)

#assign
(define <left> <right>)

#method_statement
(method <method_name> (<<args:' '>>)
    <<body>>)

#attribute
<object>.<label>

#attribute_assign
(update <object>.<label> <right>)

#binary
(<operation> <left> <right>)

#call
(! <function> <<args:' '>>)

#list
_(<<elements:' '>>)

#class_statement
(class <class_name>
    <<methods>>)

#module_statement
(module <module_name>
    <<elements>>)

Examples

pythonic example schemelike example

Installation

gem install hivemind

Usage

Run a file

hivemind <filename>

Translate a file into another syntax representation

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

Distributed under the MIT License.

More Repositories

1

Airtight

a python-like language with hindley-milner-like type system, which is compiled to c
Python
242
star
2

gara

Nim
100
star
3

matchete

A DSL for method overloading in Ruby based on pattern matching
Ruby
55
star
4

breeze

a macro dsl for nim
Nim
47
star
5

hatlog

custom type systems for python in prolog: http://alehander42.me/prolog_type_systems
Python
24
star
6

nim-quicktest

A quickcheck library for Nim
Nim
19
star
7

comprehension

Nim
18
star
8

wire

encode and decode bittorrent peer wire protocol messages with elixir
Elixir
17
star
9

sith

a macro preprocessor for ruby with ruby-like template notation
Ruby
16
star
10

tracker_request

an elixir library for dealing with bittorrent tracker requests and responses
Elixir
14
star
11

poly

Nim
10
star
12

yolandi

A simple torrent client in elixir
Elixir
5
star
13

roswell

a compiler from a python-like language to x86_64 assembly / C
Nim
5
star
14

bencoder

a library to handle bencode in elixir
Elixir
4
star
15

muu

a decorator providing multiline lambdas for Python3
Python
4
star
16

nim-linter

Nim
3
star
17

py-matchete

Python
2
star
18

melt

A language that compiles to Go with more expressive error handling, sum types and generics [ABANDONED]
Go
2
star
19

bach

a lisp dialect that compiles to cpython bytecode
Python
2
star
20

helpful_parser

Nim
2
star
21

learn-compiler

Nim
2
star
22

lodka

Nim
2
star
23

http

Nim
2
star
24

dynamo

Translate mypy annotated python files to python2-compatible
Python
2
star
25

logvm

a concatenative language implemented as a prolog dsl
Prolog
2
star
26

q

proof of a disgusting concept, functions which return results that can adapt to the call site context
Python
2
star
27

ast_diff

a tool for visualizing javascript syntax diffs
JavaScript
1
star
28

dotfiles

Shell
1
star
29

hemingway

dry wine
Python
1
star
30

lang

a hobby language: memory
Nim
1
star
31

lang-sheep

Rust
1
star
32

gagrakacka

a tiny smalltalk
Python
1
star
33

woosh-python

an experimental shell
Python
1
star
34

experiment

a playground for experiments with genetic algorithms, neural networks, pattern recognition, heuristic algorithms etc
1
star
35

delirium

JavaScript
1
star
36

placebo

placebo, a toy web rendering engine in ruby
Ruby
1
star
37

reading

1
star