This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!0:cstml bablr-language='https://github.com/bablr-lang/language-json'> | |
| <> | |
| <Array> | |
| openToken: | |
| <~*Punctuator '[' balanced=']' /> | |
| elements[]: | |
| <Number span='Number'> | |
| wholePart: | |
| <Integer> | |
| digits[]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { test as nonbacktrackingTest } from '@bablr/regex-vm'; | |
| import * as bablrLanguage from '@bablr/language-regex-vm-pattern'; | |
| import { buildTag } from 'bablr'; | |
| import { printCSTML } from '@bablr/agast-helpers/tree'; | |
| const re = buildTag(bablrLanguage, 'Pattern'); | |
| const weakMemo = (fn) => { | |
| const cache = new WeakMap(); | |
| return (arg) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!0:cstml bablr-language='https://github.com/bablr-lang/language-json'> | |
| <> | |
| <Masyvas> | |
| atidarymoŽymė: <*SkiriamasisŽenklas '[' atitinkantis=']' /> | |
| #: <*Tarpas:Tarpas '\n ' /> | |
| elementai[]: [] | |
| elementai[]: | |
| <Skaičius apimtis='Skaičius'> | |
| sveikojiDalis: | |
| <Sveikas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Utils | |
| const buildDeferred = () => { | |
| const d = {}; | |
| d.promise = new Promise((resolve, reject) => { | |
| d.resolve = resolve; | |
| d.reject = reject; | |
| }); | |
| return d; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const getStreamIterator = (obj) => { | |
| return obj[Symbol.for('@@streamIterator')]?.() || obj[Symbol.iterator]?.(); | |
| }; | |
| export class SyncGenerator { | |
| constructor(embeddedGenerator) { | |
| if (!embeddedGenerator.next) throw new Error(); | |
| this.generator = embeddedGenerator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const arrayLast = arr => arr[arr.length - 1]; | |
| const { toString } = Object.prototype; | |
| const isGenerator = val => toString.call(val) === '[object Generator]'; | |
| const cache = new Map(); | |
| function *fibonacci(n) { | |
| let value; | |
| if (cache.has(n)) return cache.get(n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| conartist6@hq bablr-cli % echo '"eat()"' | node bin/index.js -l @bablr/language-bablr-vm-instruction -p Call -f | |
| <!cstml 'https://github.com/bablr-lang/language-bablr-vm-instruction'> | |
| <> | |
| <Call> | |
| callee: | |
| <*Identifier> | |
| 'eat' | |
| </> | |
| arguments: | |
| <Tuple> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as language from '@bablr/language-cstml'; | |
| import { buildTag } from 'bablr/enhanceable'; | |
| const cstml = buildTag(language, 'Expression'); | |
| const tree = cstml`<> ${cstml`<*Word>${cstml`'ok'`}</>`} </>`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <> </> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Input: `<> </>` |