Code Monkey home page Code Monkey logo

lemon-rs's Introduction

Build Status Latest Version Docs dependency status

LEMON parser generator modified to generate Rust code.

Lemon source and SQLite3 grammar were last synced as of November 2023.

Unsupported

Unsupported Grammar syntax

  • %token_destructor: Code to execute to destroy token data
  • %default_destructor: Code for the default non-terminal destructor
  • %destructor: Code which executes whenever this symbol is popped from the stack during error processing

https://www.codeproject.com/Articles/1056460/Generating-a-High-Speed-Parser-Part-Lemon https://www.sqlite.org/lemon.html

SQLite

SQLite lexer and SQLite parser have been ported from C to Rust. The parser generates an AST.

Lexer/Parser:

  • Keep track of position (line, column).
  • Streamable (stop at the end of statement).
  • Resumable (restart after the end of statement).

Lexer and parser have been tested with the following scripts:

TODO:

Unsupported by Rust

  • #line directive

API change

  • No ParseAlloc/ParseFree anymore

Features not tested

  • NDEBUG
  • YYNOERRORRECOVERY
  • YYERRORSYMBOL

To be fixed

  • RHS are moved. Maybe it is not a problem if they are always used once. Just add a check in lemon...
  • %extra_argument is not supported.
  • Terminal symbols generated by lemon should be dumped in a specified file.

Raison d'être

  • lemon_rust does the same thing but with an old version of lemon. And it seems not possible to use yystack as a stack because items may be access randomly and the top+1 item can be used.

  • lalrpop would be the perfect alternative but it does not support fallback/streaming (see this issue) and compilation/generation is slow.

lemon-rs's People

Contributors

gwenn avatar marinpostma avatar dmzmk avatar honzasp avatar dependabot[bot] 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.