Giter Site home page Giter Site logo

hivemind's Introduction

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.

hivemind's People

Contributors

alehander92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.