Giter Club home page Giter Club logo

lingu's Introduction

Lingu

Lingu is extensible programming language that is operating with domain abstractions and not their implementation details.

This technology is WIP and exploring ideas similar to concept programming and intentional programming.

Example usage

Check out TodoMVC app implemetation with Lingu here.

Lingu in a nutshell

Lingu sentences are divided into these categories:

  1. Data structure definitions
  2. Action sentences
  3. Query definitions
  4. Translations

Each action sentence is constructed out of words. Each word is either plugin, handler, evaluator, value, query, selector or datatype.

Authors

Language components

Plugins

(words, parseState, appState) => ({mutateState: (s) => s, parseState, cursor})

context [query]

on [handler ,handler ,]

add [datatype]

with [datatype value]

remove [query]

update [query]

set [datatype value]

clear [selector]

focus [selector]

show [selector]

hide [selector]

if [value] .

else .

setInputValue [selector value]

log [value]

Handlers

Lingu.handlers.keyUp = (words) => {
  Lingu.domEventHandlers.push({
    selector: words[0],
    handler: (event) => {
      const parseState = {
        event: event
      };
      Lingu.methods.parseActionLine(words.slice(1), parseState);
    },
    event: 'keyup'
  });
};

firstRun

triggered on first run of the app

change [datatype]

triggered when change in data is detected

click [selector]

triggered on element click

blur [selector]

triggered on input element blur

missClick [selector]

triggerred when click happens outside element

doubleClick [selector]

triggered on element double click

keyUp [selector]

triggered on keyUp in input

escape [selector]

triggered on escape key in input

enter [selector]

triggered on enter key in input

Evaluators

(words, parseState, appState) => ({value: [], parseState, cursor})

from [selector]

returns value from selected elements

empty [selector]

evaluates to true if selected elements have empty value, otherwise evaluates to false

is [query value]

evaluates to true if query returns items that equal value, otherwise evaluates to false

has [query]

evaluates to true if query returns any items, otherwise evaluates to false

not [value]

evalutes to true if value is false, otherwise evaluates to false

valueOf [query]

converts query result to value

Extending the language

You can extend language by adding your own custom plugins, evaluators and handlers to Lingu.plugins, Lingu.evaluators and Lingu.handlers.

Running unit tests

$ npm install
$ npm run test

Running e2e tests

$ npm install
$ node server.js
$ java -jar selenium-standalone.jar
$ npm run e2e

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.