JavaScript Expression Notation (JSEN)
Still need to complete the unit test coverage and add a couple more features. I made a change from my original post to the syntax for namespace references. (The reason? I realized I needed to be able to use "*" as a local identifier for multiplication.)
This is possible right now:
jsen.decl('my-fake-namespace', { 'js': 'http://ecma-international.org/ecma-262/5.1', 'x': 10, 'y': ['js:Array', 1, 2, 3], 'z': ['js:[]', 'y', 1] }); jsen.eval('my-fake-namespace', 'x'); // 10 jsen.eval('my-fake-namespace', 'y'); // [1, 2, 3] jsen.eval('my-fake-namespace', 'z'); // 2jsen.expr('my-fake-namespace', 'x'); // 10// Deprecatedjsen.expr('my-fake-namespace', 'y');// Deprecated// ["http://ecma-international.org/ecma-262/5.1:Array", 1, 2, 3] jsen.expr('my-fake-namespace', 'z');// Deprecated// ["http://ecma-international.org/ecma-262/5.1:[]", "y", 1]
Eventually something like this will be possible as well:
jsen.namesonnodes.decl(); jsen.decl({ 'char': 'my-character-states-space', 'non': 'http://namesonnodes.org/ns/math/2013:', 'unit': 'my-unit-nomenclature-space', 'http://namesonnodes.org/ns/math/2013': { 'phylogeny': ['non:dag', ['non:arc', 'unit:0', 'unit:Ornithorhynchus anatinus' ], ['non:arc', 'unit:0', 'unit:1' ], ['non:arc', 'unit:1', 'unit:Canis lupus' ], ['non:arc', 'unit:1', 'unit:Homo sapiens' ] ] }, 'my-character-states-space': { 'extant': ['non:union', 'unit:Homo sapiens', 'unit:Canis lupus', 'unit:Ornithorhynchus anatinus' ], 'placentum': ['non:union', 'unit:Homo sapiens', 'unit:Canis lupus', 'unit:1' ] }, 'my-phylogenetic-nomenclature-space': { 'Apo-Placentalia': ['non:clade', ['non:synprc', 'char:placentum', 'unit:Homo sapiens' ] ], 'Mammalia': ['non:clade', ['non:union', 'unit:Homo sapiens', 'unit:Ornithorhynchus anatinus' ] ], 'Placentalia': ['non:crown', 'Apo-Placentalia'], 'Prototheria': ['non:clade', ['non:branch', 'unit:Ornithorhynchus anatinus', 'unit:Homo sapiens' ] ], 'Theriimorpha': ['non:clade', ['non:branch', 'unit:Homo sapiens', 'unit:Ornithorhynchus anatinus' ] ], 'pan-Theria': 'Theriimorpha', 'pan-Monotremata': 'Prototheria' }, 'my-unit-nomenclature-space': jsen.namesonnodes.unit });
No comments:
Post a Comment