Coder Social home page Coder Social logo

nanobowers / natalie_parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from natalie-lang/natalie_parser

0.0 1.0 0.0 972 KB

NatalieParser is a zero-dependency, from-scratch, hand-written recursive descent parser for the Ruby Programming Language.

License: MIT License

Ruby 42.57% C++ 57.38% Dockerfile 0.05%

natalie_parser's Introduction

Natalie Parser

Gem Version github build status MIT License

This is a parser for the Ruby programming language, written in C++. It was extracted from the Natalie project.

You can use this library directly from a C/C++ project, or you can build it as a Ruby gem and use it from Ruby itself.

We are currently targeting Ruby 3.0 syntax, but that will probably change over time, depending on what things we want to support and what kind of help we get from the community.

NOTE: This project is still very new and there are certainly bugs. See the list below for things we already know about, but expect there are more we don't know about yet. We don't recommend you use this in production applications.

To Do

  • Parse the Natalie compiler and standard library
  • Pass (mostly) the RubyParser test suite
  • Support different source encodings
  • Support more of the Ruby 3.0 syntax
    • "Endless" method definition (def foo = bar)
    • Argument forwarding (...)
    • Numbered block parameters (_1, _2, etc.)
    • Rational and Complex literals (1r and 2i)
    • Non-ASCII identifiers
    • Pattern matching

Development

You'll need:

  • gcc or clang
  • ruby-dev (dev headers)
  • ccache (optional)
  • compiledb (optional)
rake
ruby -I lib:ext -r natalie_parser -e "p NatalieParser.parse('1 + 2')"
# => s(:block, s(:call, s(:lit, 1), :+, s(:lit, 2)))

Running Tests

rake test

Copyright & License

Natalie is copyright 2022, Tim Morgan and contributors. Natalie is licensed under the MIT License; see the LICENSE file in this directory for the full text.

Note about Outside Sources

The file test/test_ruby_parser.rb is copyright Ryan Davis and is licensed MIT.

natalie_parser's People

Contributors

seven1m avatar fncontroloption avatar timcraft avatar richardboehme avatar nanobowers 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.