match-iz
ohm
match-iz | ohm | |
---|---|---|
11 | 10 | |
133 | 4,886 | |
- | 0.6% | |
6.6 | 6.5 | |
17 days ago | 6 days ago | |
JavaScript | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
match-iz
-
match-iz: a tiny pattern-matching library
Thank you, and it does!
-
Javascript futures and Result monads belong together
I do enjoy a bit of monad'ing. I often use this minimal Maybe in projects, inspired by Folktale and Crocks.
-
Defeating Javascript Obfuscation
I've done a little myself with eslint-plugins and codemods and found it useful for avoiding repetition and ?.. There's a TC39 proposal that's in the works, but I got impatient and wrote a small lib that tries to provide the same functionality.
-
Upcoming ECMAScript features I'm excited about
I'm doing my part, though!
-
[AskJS] favorite JavaScript library
Honestly, my own. Not that I can take credit for the fundamental shape of the API -- it's directly inspired by the TC39 pattern-matching proposal. Still, I use it all the time and can't wait for the day when I don't have to.
-
oxide.ts - my Rust-inspired Option/Result and match library - Version 1.0 Release
Slightly related is this pattern matching library I saw the other week, you might be interested: https://github.com/shuckster/match-iz
- match-iz: A tiny pattern-matching library in the style of the TC39 proposal
-
Does JavaScript have an equivalent for this?
JavaScript doesn't have that natively yet, but you can get close using a library:
-
[AskJS] Why does our community hate Operator Overloading?
While pattern-matching doesn't exist in the language yet, there are many libraries on NPM for it, and it looks applicable for your own use-cases. (Full disclosure: The above example is from my own.)
-
Pattern matching = switch++
After learning about the exciting, but sadly only Stage 1 proposal for pattern-matching in JavaScript, I felt compelled to write a library that tries to, erm, match it as closely as I could:
ohm
-
Ohm: A library and language for building parsers, interpreters, compilers, etc.
Building an interpreter or a compiler from a grammar is an interesting idea. I can't immediately see how to go about it - the grammar would need to match on SSA or similar.
The examples have a lisp-like interpreter at https://github.com/ohmjs/ohm/blob/main/examples/simple-lisp/... which definitely uses a grammar for parsing and might use a generic AST representation.
Will have to think more - a grammar might be a worthwhile way to specify a nanopass style compiler pipeline.
-
Is there a generalised, abstract programming language, designed to be specialised to a specific domain?
Look for OMeta and its successor Ohm.
-
[AskJS] Why does our community hate Operator Overloading?
One more suggestion: Maybe create your own scripting-language using Ohm? The project works in JavaScript, so whatever you created would sit on top of your existing APIs.
-
A different / new way to write compilers?
OMeta and its successor ohm might provide some interesting ideas.
-
Ohm – A library and language for building parsers, interpreters, compilers, etc.
Always fun to find the first commit:
https://github.com/harc/ohm/commit/4611bf63c5ecb90d782112d68...
2014
Neat tool. I write parsers by hand though. More fun, and you can be a lot sleazier.
What are some alternatives?
Zeronode - Zeronode - minimal building block for NodeJS microservices
PEG.js - PEG.js: Parser generator for JavaScript
proposal-pattern-matching - Pattern matching syntax for ECMAScript
peggy - Peggy: Parser generator for JavaScript
bhai-lang - A toy programming language written in Typescript
Pegged - A Parsing Expression Grammar (PEG) module, using the D programming language.
proposal-operator-overloading
usfm-grammar - An elegant USFM parser.
crocks - A collection of well known Algebraic Data Types for your utter enjoyment.
Chevrotain - Parser Building Toolkit for JavaScript
meowlang - Meow Programming Language
pymetaterp - A python parser that builds python ASTs in 502 lines of python without using modules