Giter Site home page Giter Site logo

dqbd / ts-math-evaluate Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 0.0 13.58 MB

Type-level math expression evaluator for TypeScript.

Home Page: https://ts-math-evaluate.vercel.app/

TypeScript 19.04% TeX 50.91% Jupyter Notebook 30.05%
math parser type-level-programming typescript

ts-math-evaluate's Introduction

TS-Math-Evaluate

TS-Math-Evaluate

ts-math-evaluate is a type-level library for evaluating mathematical expressions in TypeScript, developed as a master thesis, implementing core mathematical operations and the accompanying evaluator, demonstrating the power of the TypeScript type system and the ability to perform complex meta-programming within the type system itself.

Alongside the evaluator, the expression parser and the accompanying parser generator can accept any LL(1) grammar and can be used to parse more complex formats, such as JSON. Finally, a benchmarking tool is provided, which can be used to benchmark any type-level code in isolation, keeping all the test cases in a single file.

A comprehensive guide to the TypeScript syntax and type-level programming techniques is provided to broaden the understanding of the capabilities of this language, seen here (ctufit-thesis.pdf).

Installation

npm install ts-math-evaluate

Usage

import type { Evaluate } from "ts-math-evaluate"

type Basic = Evaluate<
  "3.1 + 2.5 * (1 - 5.6) / 4.2"
>

type Advanced = Evaluate<
  "truncate(root(4, 2))! * -floor(1.5) + abs(-1) + ceil(root(4, 2))"
>

For full documentation, please visit https://ts-math-evaluate.vercel.app/.

ts-math-evaluate's People

Contributors

dqbd avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.