All Projects → EricSmekens → Jsep

EricSmekens / Jsep

Licence: mit
JavaScript Expression Parser

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Jsep

Stryker Net
Mutation testing for .NET core and .NET framework!
Stars: ✭ 491 (-4.66%)
Mutual labels:  hacktoberfest
Obs Web
OBS-web - the easiest way to control OBS remotely
Stars: ✭ 512 (-0.58%)
Mutual labels:  hacktoberfest
Octolinker
OctoLinker — Links together, what belongs together
Stars: ✭ 4,853 (+842.33%)
Mutual labels:  hacktoberfest
State Machine Cat
write beautiful state charts 🙀
Stars: ✭ 509 (-1.17%)
Mutual labels:  hacktoberfest
Hacktoberfest
Hacktoberfest - App to manage the annual open source challenge.
Stars: ✭ 512 (-0.58%)
Mutual labels:  hacktoberfest
Hackers
Hackers is an elegant iOS app for reading Hacker News written in Swift.
Stars: ✭ 513 (-0.39%)
Mutual labels:  hacktoberfest
Worldview
Interactive interface for browsing global, full-resolution satellite imagery
Stars: ✭ 504 (-2.14%)
Mutual labels:  hacktoberfest
Devjoke
#DevJoke. Submit a PR if you know a good dev joke.
Stars: ✭ 516 (+0.19%)
Mutual labels:  hacktoberfest
Yopass
Secure sharing for secrets, passwords and files
Stars: ✭ 511 (-0.78%)
Mutual labels:  hacktoberfest
Telethon
Pure Python 3 MTProto API Telegram client library, for bots too!
Stars: ✭ 5,805 (+1027.18%)
Mutual labels:  hacktoberfest
Astroquery
Functions and classes to access online data resources. Maintainers: @keflavich and @bsipocz and @ceb8
Stars: ✭ 510 (-0.97%)
Mutual labels:  hacktoberfest
Flex
The minimalist Pelican theme.
Stars: ✭ 510 (-0.97%)
Mutual labels:  hacktoberfest
Uno
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
Stars: ✭ 6,029 (+1070.68%)
Mutual labels:  hacktoberfest
Web3.php
A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
Stars: ✭ 507 (-1.55%)
Mutual labels:  hacktoberfest
Messagekit
A community-driven replacement for JSQMessagesViewController
Stars: ✭ 5,036 (+877.86%)
Mutual labels:  hacktoberfest
Vertical Stack In Card
📐 Home Assistant Card: Similar to vertical/horizontal-stack, but removes card borders
Stars: ✭ 507 (-1.55%)
Mutual labels:  hacktoberfest
Topydo
A powerful todo list application for the console, using the todo.txt format.
Stars: ✭ 511 (-0.78%)
Mutual labels:  hacktoberfest
Guide
The official guide for discord.js, created and maintained by core members of its community
Stars: ✭ 512 (-0.58%)
Mutual labels:  hacktoberfest
Sentry Symfony
The official Symfony SDK for Sentry (sentry.io)
Stars: ✭ 515 (+0%)
Mutual labels:  hacktoberfest
Imagesharp
📷 A modern, cross-platform, 2D Graphics library for .NET
Stars: ✭ 5,186 (+906.99%)
Mutual labels:  hacktoberfest

jsep: A Tiny JavaScript Expression Parser

jsep is a simple expression parser written in JavaScript. It can parse JavaScript expressions but not operations. The difference between expressions and operations is akin to the difference between a cell in an Excel spreadsheet vs. a proper JavaScript program.

Why jsep?

I wanted a lightweight, tiny parser to be included in one of my other libraries. esprima and other parsers are great, but had more power than I need and were way too large to be included in a library that I wanted to keep relatively small.

jsep's output is almost identical to esprima's, which is in turn based on SpiderMonkey's.

Custom Build

First, install Grunt. While in the jsep project directory, run:

npm install .
grunt

The jsep built files will be in the build/ directory.

Usage

Client-side

<script src="/PATH/TO/jsep.min.js" type="text/javascript"></script>
...
var parse_tree = jsep("1 + 1");

Node.JS

First, run npm install jsep. Then, in your source file:

var jsep = require("jsep");
var parse_tree = jsep("1 + 1");

Custom Operators

// Add a custom ^ binary operator with precedence 10
jsep.addBinaryOp("^", 10);

// Add a custom @ unary operator
jsep.addUnaryOp('@');

// Remove a binary operator
jsep.removeBinaryOp(">>>");

// Remove a unary operator
jsep.removeUnaryOp("~");

License

jsep is under the MIT license. See LICENSE file.

Thanks

Some parts of the latest version of jsep were adapted from the esprima parser.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].