Giter Club home page Giter Club logo

yarp's Introduction

Yet Another Ruby Parser

This is a parser for the Ruby programming language. It is designed to be portable, error tolerant, and maintainable. It is written in C99 and has no dependencies. It is currently being integrated into CRuby, JRuby, TruffleRuby, Sorbet, and Syntax Tree.

Overview

The repository contains the infrastructure for both a shared library (librubyparser) and a native CRuby extension. The shared library has no bindings to CRuby itself, and so can be used by other projects. The native CRuby extension links against ruby.h, and so is suitable in the context of CRuby.

.
├── Makefile              configuration to compile the shared library and native tests
├── Rakefile              configuration to compile the native extension and run the Ruby tests
├── bin
│   ├── lex               runs the lexer on a file or string, prints the tokens, and compares to ripper
│   └── parse             runs the parser on a file or string and prints the syntax tree
├── config.yml            specification for tokens and nodes in the tree
├── docs                  documentation about the project
├── ext
│   └── yarp
│       ├── extconf.rb    configuration to generate the Makefile for the native extension
│       └── extension.c   the native extension that interacts with librubyparser
├── fuzz                  files related to fuzz testing
├── include
│   ├── yarp              header files for the shared library
│   └── yarp.h            main header file for the shared library
├── java                  Java bindings for the shared library
├── lib
│   ├── yarp              Ruby library files
│   └── yarp.rb           main entrypoint for the Ruby library
├── rakelib               various Rake tasks for the project
├── rust
│   ├── yarp              Rustified crate for the shared library
│   └── yarp-sys          FFI binding for Rust
├── src
│   ├── enc               various encoding files
│   ├── util              various utility files
│   └── yarp.c            main entrypoint for the shared library
├── templates             contains ERB templates generated by templates/template.rb
│   └── template.rb       generates code from the nodes and tokens configured by config.yml
└── test
    └── yarp
        ├── fixtures      Ruby code used for testing
        └── snapshots     snapshots of generated syntax trees corresponding to fixtures

Getting started

To compile the shared library, you will need:

  • A C99 compiler
  • autotools autoconf, automake, libtool)
  • make
  • Ruby 3.3.0-preview1 or later

Once you have these dependencies, run:

bundle install

to fetch the Ruby dependencies. Finally, run:

rake compile

to compile the shared library. It will be built in the build directory. To test that everything is working, run:

bin/parse -e "1 + 2"

to see the syntax tree for the expression 1 + 2.

Contributing

See the CONTRIBUTING.md file for more information. We additionally have documentation about the overall design of the project as well as various subtopics.

yarp's People

Contributors

adisonlampert avatar andrykonchin avatar andyw8 avatar bitwise-aiden avatar ccocchi avatar chrisseaton avatar dmitrytsepelev avatar drbragg avatar egiurleo avatar enebo avatar eregon avatar flavorjones avatar fncontroloption avatar froydnj avatar haldun avatar hparker avatar iliabylich avatar jemmaissroff avatar k0kubun avatar kddnewton avatar marcoroth avatar max-leopold avatar nobu avatar ojab avatar paracycle avatar rafaelfranca avatar seven1m avatar stevenjohnstone avatar tenderlove avatar vinistock 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.