shikipl
v0.1.1
Published
Process formulae by ASCII art
Readme
ShikiPL
ShikiPL computes mathematical formulae written by ASCII art.
ShikiPL translates ASCII art to JavaScript code.
Install
To install ShikiPL, type the command shown as follows.
$ npm install -g shikiplHow to use
A ShikiPL code which you want to bury in JavaScript is written in \[...\] block.
var f = \[
a = 1
2
f(x) = 2x + 1
\]In above example, the variable f has two properties.
One of property is a, which is a constant value 1, and another property is f which is a function with argument x.
You can use object which is generated by ShikiPL by shown as follows.
console.log(f.f(2)); // outputs 9To translate ShikiPL to JavaScript, executes the command shown as follows.
$ shikipl filename.js.shikiplExample
Simple formula
var f = \[
2
f(x) = 2x + 1
\]
console.log(f.f(2)); // outputs 9Fraction
var f = \[
x + 1
f(x) = -------
2
\]
console.log(f.f(1)); // outputs 1Square root: a solution of quadratic equation
var f = \[
________
/ 2
-b + v b - 4ac
f(a, b, c) = -----------------
2a
\]
console.log(f.f(2, -4, 2)); // outputs 1Trigonometric function
var f = \[
f(a) = sin a
\]
console.log(f.f(Math.PI / 2)); // outputs 1Power of trigonometric function
var f = \[
2 2
f(a) = sin a + cos a
\]
console.log(f.f(8.765346283)); // outputs 1Logarithm
var f = \[
f(a) = log a
\]
console.log(f.f(Math.E)); // outputs 1Logarithm with base
var f = \[
f(a) = log a
2
\]
console.log(f.f(8)); // outputs 3Document
A document of ShikiPL is here.
License
MIT
