Giter Site home page Giter Site logo

duktape's Introduction

Duktape

Duktape is a small and portable ECMAScript E5/E5.1 implementation. It is intended to be easily embeddable into C programs, with a C API similar in spirit to Lua's.

Duktape supports the full E5/E5.1 feature set (with some semantics updated from ES2015+) including errors, Unicode strings, and regular expressions, a subset of ECMAScript 2015 (E6) and ECMAScript 2016 (E7) features (e.g. computed property names, Proxy objects, exponentiation operator, Reflect), ES2015 ArrayBuffer/TypedView, Node.js Buffer, performance.now(), and WHATWG Encoding API living standard.

Duktape also provides a number of custom features such as error tracebacks, additional data types for better C integration, combined reference counting and mark-and sweep garbage collector, object finalizers, co-operative threads a.k.a. coroutines, tail calls, a built-in debugger protocol, function bytecode dump/load, and so on. Bundled extra modules provide functionality such as CommonJS module loading and a logging framework.

You can browse Duktape programmer's API and other documentation at:

In particular, you should read the getting started section:

More examples and how-to articles are in the Duktape Wiki:

To build an example command line tool with interactive evaluation (REPL) and the ability to run script files:

$ cd <dist_root>
$ make -f Makefile.cmdline
[...]

$ ./duk
((o) Duktape
duk> print('Hello world!');
Hello world!
= undefined

$ ./duk mandel.js
[...]

To integrate Duktape into your program:

  • Use tools/configure.py to prepare Duktape source and header files for build:

    # Duktape options can be customized via command line options.
    # In this example, enable "fastint" support and disable ES2015
    # Proxy support
    
    $ python2 tools/configure.py --output-directory duktape-src \
          -DDUK_USE_FASTINT -UDUK_USE_ES6_PROXY
  • The output directory (duktape-src) will then contain duktape.c, duktape.h, and duk_config.h which you include in your build.

For more details, see:

This distributable contains:

  • Pre-configured Duktape header and source files using the Duktape default configuration:
    • src/: main Duktape library in a "single source file" format (duktape.c, duktape.h, and duk_config.h).
    • src-noline/: contains a variant of src/duktape.c with no #line directives which is preferable for some users. See discussion in svaarala/duktape#363.
    • src-separate/: main Duktape library in multiple files format.
  • src-input/: raw input source files used by configure.py which recreates the combined/separate prepared sources with specific options.
  • tools/: various Python tools, such as configure.py for preparing a duk_config.h header and Duktape source files for compilation, see http://wiki.duktape.org/Configuring.html.
  • config/: configuration metadata for configure.py.
  • examples/: further examples for using Duktape. Although Duktape itself is widely portable, some of the examples are Linux only. For instance the eventloop example illustrates how setTimeout() and other standard timer functions could be implemented on Unix/Linux.
  • extras/: utilities and modules which don't comfortably fit into the main Duktape library because of footprint or portability concerns. Extras are maintained and bug fixed code, but don't have the same version guarantees as the main Duktape library.
  • polyfills/: a few replacement suggestions for non-standard Javascript functions provided by other implementations.
  • debugger/: a debugger with a web UI, see debugger/README.rst and https://github.com/svaarala/duktape/blob/master/doc/debugger.rst for details on Duktape debugger support. Also contains a JSON debug proxy (one written in Node.js and another in DukLuv) to make talking to the debug target easier.
  • licenses/: licensing information.

You can find release notes at:

This distributable contains Duktape version 2.3.0, created from git commit d7fdb67f18561a50e06bafd196c6b423af9ad6fe (v2.3.0).

Duktape is copyrighted by its authors (see AUTHORS.rst) and licensed under the MIT license (see LICENSE.txt). String hashing algorithms are based on the algorithm from Lua (MIT license), djb2 hash, and Murmurhash2 (MIT license). Pseudorandom number generator algorithms are based on Adi Shamir's three-op algorithm, xoroshiro128+ (public domain), and SplitMix64 (public domain). Duktape module loader is based on the CommonJS module loading specification (without sharing any code), CommonJS is under the MIT license.

Have fun!

Sami Vaarala ([email protected])

duktape's People

Contributors

jeroenbogersphilips avatar

Watchers

 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.