Giter Club home page Giter Club logo

Comments (3)

svaarala avatar svaarala commented on May 29, 2024

Originally I wrote the engine as a separate thing (constrained to the Ecmascript feature set of course), so it should be possible to extract the central parts with a reasonable effort:

  • The regexp compilation primitive (duk_parse_disjunction() and parts of duk_parse_regexp())
  • The regexp execution primitive (duk__match_regexp()) which attempts a match from a certain offset

These depend on Duktape for a few things: the buffer datatype is used to construct the bytecode, utf-8 helpers are used for codepoint conversions (the regexp bytecode used by Duktape is actually a series of codepoints). Also they call into Duktape error handling, etc.

Above that it gets quite Ecmascript/Duktape specific. To keep footprint minimal there is no abstract data structure for providing a match result (this is something you'd expect to have in a generic library); rather an Ecmascript result is constructed directly. These parts you'd need to reimplement, perhaps checking whether you want to replicate the detailed Ecmascript semantics or not (e.g. how global matching is implemented).

If you end up taking this approach, send me an e-mail and I'll be happy to help if I can.

from duktape.

kevinswiber avatar kevinswiber commented on May 29, 2024

Thanks for the info, @svaarala! I'll keep you updated.

from duktape.

kevinswiber avatar kevinswiber commented on May 29, 2024

Closing. Will follow up via e-mail. Looking at this stuff now. Thanks again!

from duktape.

Related Issues (20)

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.