Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babelute

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babelute - npm Package Compare versions

Comparing version 0.1.0 to 0.4.0

.babelrc

72

package.json
{
"name": "babelute",
"version": "0.1.0",
"description": "Internal Domain Specific Language javascript framework",
"main": "index.js",
"version": "0.4.0",
"description": "Internal Domain Specific (Multi)Modeling javascript framework",
"main": "dist/es5/index.js",
"module": "src/index.js",
"jsnext:main": "src/index.js",
"scripts": {
"test": "mocha"
"prebuild": "eslint src test",
"build": "npm run es5-build && npm run bundles-build && uglifyjs dist/bundles/index.js -m -o dist/bundles/index.min.js",
"es5-build": "babel src -d dist/es5",
"es5-watch": "babel src -d dist/es5 -w",
"bundles-build": "rollup -c",
"bundles-watch": "rollup -c -w",
"pretest": "npm run build",
"test": "mocha",
"karma": "NODE_ENV=production karma start",
"cover": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.js",
"prepublish": "NODE_ENV=production npm test",
"esdoc": "npm test && esdoc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nomocas/babelute.git"
"nyc": {
"require": [
"babel-register"
],
"sourceMap": false,
"instrument": false
},
"keywords": [
"internal-DSL",
"DSL",
"domain-specific-language",

@@ -20,7 +37,10 @@ "method-chaining",

"modeling",
"document",
"semantic"
"semantic",
"pragmatics",
"fluent-interface"
],
"author": "Gilles Coomans",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/nomocas/babelute.git"
},
"bugs": {

@@ -30,5 +50,31 @@ "url": "https://github.com/nomocas/babelute/issues"

"homepage": "https://github.com/nomocas/babelute#readme",
"dependencies": {
"elenpi": "^0.3.0"
"author": "Gilles Coomans",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"assert": "^1.4.1",
"babel-cli": "^6.14.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-istanbul": "^2.0.2",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-unassert": "^2.1.2",
"babel-preset-es2015": "^6.14.0",
"babel-register": "^6.14.0",
"babelrc-rollup": "^3.0.0",
"chai": "^3.5.0",
"cross-env": "^2.0.1",
"eslint": "^3.15.0",
"eslint-plugin-import": "^2.2.0",
"karma": "^1.4.1",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.0.0",
"karma-mocha": "^1.3.0",
"karma-rollup-preprocessor": "^3.0.3",
"mocha": "^3.0.2",
"nyc": "^8.1.0",
"rollup": "^0.41.4",
"rollup-plugin-babel": "^2.7.1",
"rollup-watch": "^3.2.2",
"uglify-js": "^2.7.5"
}
}

184

README.md

@@ -1,171 +0,47 @@

# Babelute
# Babelute.js
Internal Domain Specific Language javascript framework based on Method Chaining
and dedicated to Domain Specific (multi)Modeling (DSM).
> __42__ ≈ _[ lexem( lexicon, name, arguments ), ... ]_
or How to design and code as you think...
And boost your productivity as never.
### Internal Domain Specific (Multi)Modeling js framework
Really small, simple, incredibly powerful and super fast.
[![npm](https://img.shields.io/npm/v/babelute.svg)]()
[![npm-downloads](https://img.shields.io/npm/dm/babelute.svg)]()
[![licence](https://img.shields.io/npm/l/babelute.svg)]()
[![dependecies](https://img.shields.io/david/nomocas/babelute.svg)]()
[![dev-dependencies](https://img.shields.io/david/dev/nomocas/babelute.svg)]()
[![npm-stats](https://nodei.co/npm/babelute.png?downloads=true)]()
(documentation in progress)
Really small, simple, incredibly powerful and super fast __Fact Based Internal DSLs__ tools.
## Aim
The aim of Babelute is to provide :
- a simple "(meta) meta language" (a grammar - based on Method Chaining) and tools for Domain Specific Language definition
- tools for managing dictionaries (called lexics) of those DSL (namespaces, translations between languages, real semantics depending to specific context, etc)
- helpers for writing structured "sentences" (called "babelutes") in those DSL (always based on Method Chaining)
- ways to interpret/run sentences depending on a particular context (sentence-to-sentence or sentence-to-specific-actions)
- ways to execute Babelute sentences immediatly (and only once - classical simple Method Chaining)
- ways to execute Babelute sentences on demand (sentence's elements are kept in local array), and therefor they could be seen as multi-purpose template. (where they release all their potential)
- tools to make Babelute sentences handelable and editable
- a lightweight optimal serialised form of Babelute sentences and the associated parser/stringifier
> "_A Babelut(t)e is a sort of long toffee flavoured with honey or vergeoise (demerara sugar) from [...] Flanders, Belgium_".
> __Etymology__ : "_[A french word that] is likely to come from the Flemish "babbelen", speaking a lot, and "uit", finished because when you eat the toffee, you cannot speak anymore (either because you are enjoying it or because you cannot open the mouth).[...]_" - src : [wikipedia](https://en.wikipedia.org/wiki/Babelutte)
## Fluent Interfaces as DSL
Expressing DSL with Fluent Interface is something that is well known today.
The term "Fluent Interface" comes from Martin Fowler's [2005 article](http://martinfowler.com/bliki/FluentInterface.html) where he associated clearly Internal DSL and fluency.
Babelute.js core library (this lib) provides helpers to :
- define and manage Internal DSLs for __modeling__ any kind of problems
- with a simple (meta)grammar - based on Method Chaining - for writing __structured unambiguous "sentences"__ (called __babelutes__)
- and to provide ways :
- to manage __dictionaries of related lexems__ that form DSL semantic fields (called __lexicons__)
- to translate DSL sentences to other DSL sentences (through __dedicated bridge-DSLs__ with its/their own lexicon(s))
- to interpret sentences in many context with specific __fine grained dedicated semantics__ (called __pragmatics__)
Fluent interfaces does not mean necessary Method Chaining. It's just one way to achieve it.
And Method Chaining doesn't mean necessary Internal DSL.
Fluent Internal DSL are much more about choosing right words with right semantics for optimaly expressing particular problems through readable and meaningful sentences. Not simply chaining calls.
## Core Libraries
Examples of Domain Specific Language expressed with Method Chaining :
- babelute (this lib)
- [babelute-uus](https://github.com/nomocas/babelute-uus) : Universal Unambiguous Sentences proposal : Welcome in Sharing Era.
SQL in JAVA : http://www.jooq.org/
```java
create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count())
.from(AUTHOR)
.join(BOOK).on(AUTHOR.ID.equal(BOOK.AUTHOR_ID))
.where(BOOK.LANGUAGE.eq("DE"))
.and(BOOK.PUBLISHED.gt(date("2008-01-01")))
.groupBy(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME)
.having(count().gt(5))
.orderBy(AUTHOR.LAST_NAME.asc().nullsFirst())
.limit(2)
.offset(1)
```
## Understanding by examples
RTF Doc construction in JAVA : https://github.com/ullenboom/jrtf/
```java
rtf().section(
p( "first paragraph" ),
p( tab(),
" second par ",
bold( "with something in bold" ),
text( " and " ),
italic( underline( "italic underline" ) )
)
).out( out );
```
Low Level DSLs (Developement related domains) :
- [babelute-aright](https://github.com/nomocas/babelute-aright) : Objects and types validation DSL (ultra-fast, ultra-modular)
- [babelute-html](https://github.com/nomocas/babelute-html) : HTML5 DSL and its isomorphic render-engines. (modern, __world's fastest__, one-way-binding templating (React philosophy))
- [babelute-lexicon-definition-language](https://github.com/nomocas/babelute-doc) : Babelute Lexic Definition DSL and its generators.
Further reading :
- http://leecampbell.blogspot.be/2008/11/method-chaining-to-create-your-dsl.html
- https://sanaulla.info/2013/05/30/creating-internal-dsls-in-java-java-8-adopting-martin-fowlers-approach
- https://msdn.microsoft.com/en-us/magazine/ee291514.aspx
- https://books.google.be/books?id=EhOXBQAAQBAJ&pg=PA403&lpg=PA403&dq=method+chaining+DSL&source=bl&ots=vMd25Y86E1&sig=d7SbHZoiLA8X1g4nsoo5Ph5kHTA&hl=fr&sa=X&ved=0ahUKEwiR_-32usvOAhUSahoKHTk2C9Y4ChDoAQgwMAM#v=onepage&q=method%20chaining%20DSL&f=false
High Level DSLs (Human related domains) :
- [babelute-cooking](https://github.com/nomocas/babelute-cooking) : High Level Cooking DSL demo and its bunch of transformations and DSLs targets.
## DSM
Model Driven approach. (Model First, automation, standard)
## Translation Chain : From High Level to Code Level
Community of Abstract and Concreet DSLs.
## DSL as "Template"
Method Chaining along with Command Design Pattern to build Facade.
RSIC vs CISC
Auto-parsing
## Template as Document
From persistence, to meta-programing, to shadow document.
### Order means everything
### Lightweight optimal serialised form
#### Introduce elenpi
#### Persitence
### Document edition and meta-programing
#### Chained DSL Facade as Document Pilot
#### GUI for all
### Document instanciation, data-binding and Shadow Document
## Todo soon
- debug and report
- open problem : meta-model and model evolution and versioning
(maybe introduce Consumer Contract Driven logics)
## Further
- coordination problem and method
- Link with ontologies
- Inference Engine
- DSL repository
- Web exposition
- DSL-DB
# Babelute examples
```javascript
var b = require('babelute').b;
// define language "foo" with 3 words
Babelute.toLexic('family', ['myMethod', 'mySecondMethod', 'myThirdMethod']);
// you could directly write sentences with it
var myBabelute = b('foo')
.myMethod()
.mySecondMethod('John', true)
.myThirdMethod(
b('foo')
.mySecondMethod('Biloud', false);
);
//...
// then provides semantics for those words
Babelute.toActions('foo:bar', {
myMethod:function(env, subject, args){
subject.first = true;
},
mySecondMethod:function(env, subject, args){
subject.second = 'Hello '+ args[0] + ' ! ' + (args[1] ? 'Greetings.' : '');
},
myThirdMethod:function(env, subject, args){
subject.third = args[0]._output(env, {}); // sub-babelute usage
}
});
//...
// then output sentence with your semantics
var output = myBabelute._output('foo:bar', {});
// => {first:true, second:'Hello John ! Greetings.', third:{ second:'Hello Biloud !' } }
```
More coming really soon.
## Licence

@@ -175,3 +51,3 @@

Copyright (c) 2016 Gilles Coomans <gilles.coomans@gmail.com>
Copyright (c) Gilles Coomans <gilles.coomans@gmail.com>

@@ -178,0 +54,0 @@ 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 restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc