diesel v1.0.2
DIESEL JS
What is DIESEL ?
Diesel is widely used in AutoCAD
This Dumb Interpretively Executed String Expression Language is the kernel of a macro language you can customize by adding C code and embedding it into your program.
It is short, written in portable C, and is readily integrated into any program. It is useful primarily for programs that need a very rudimentary macro expansion facility without the complexity of a full language such as Lisp or FORTH.
Try it online: https://dderevjanik.github.io/diesel-js/
Our DIESEL documentation with Examples: ./docs/DIESEL.md
Fourmilab DIESEL Documentation
What is DIESEL JS ?
Diesel JS is a JavaScript compilation of the DIESEL language using Emscripten. It is a simple and easy-to-use library that allows you to evaluate DIESEL expressions in JavaScript.
Diesel JS is compiled with
Usage
Install package npm i diesel
Browser
Node
import { evaluate } from "diesel";
const result = await evaluate("$(+, 1, 2)");
console.log(result); // 3CLI
npx diesel '$(+, 1, 2)'
or by installing diesel-cli globally npm i -g diesel and then using diesel '$(+, 1, 2)'
Try it online
https://dderevjanik.github.io/diesel-js/
Examples
Checkout Diesel Examples
Differences with AutoCAD DIESEL
AutoCAD extends DIESEL with additional functions and variables. This library does not support all of them, but it does support the most common ones. Functions like rtos and angtos are not supported in DIESEL JS.
Development
(Optional) Compiling DIESEL into WASM
In order to compile DIESEL into javascript, you need to have Docker installed (emscripten is used to compile the C code into WebAssembly).
npm run compile-diesel
Running the project
npm iinstall dependenciesnpm testto run unit tests (based on Fourmilab DIESEL tests)ts-node ./src/cli.ts -hto run the CLI
TODO
- Add AutoCAD functions (
rtos,angtos, etc.) - Publish to NPM