gml-parser

0.2.9 • Public • Published

gml-parser

a parser for Groovy DSL like Marked Language

What is GML

GML stand for 'Grovvy DSL like markup language', it has a form like any other markup language, like XML, but is more general and expressive.

a sample below

// a DSL of HTML, by GML grammar
html {
  head { title='a script of GML' }
  body {
    div {
      id="root"
    };
    script {
      type="text/GML"
      content = GScript {
        assign(document[querySelector]('root')[content], 'hello world')
      }
    }
  }
}

usage

import {fromString} from 'gml-parser'
 
let p = fromString('a(b, c) {d=0}');
expect(p).toEqual({type:'texp', 
  tag:'a', 
  blocks:[[
    {type:'var', name:'b'}, 
    {type:'var', name:'c'}], 
    [{type:'assign', variable:'d', exp:0}]]})
 

Readme

Keywords

none

Package Sidebar

Install

npm i gml-parser

Weekly Downloads

2

Version

0.2.9

License

MIT

Unpacked Size

128 kB

Total Files

10

Last publish

Collaborators

  • operali