Giter Site home page Giter Site logo

chyyuu / racc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sivadeilra/racc

0.0 2.0 0.0 628 KB

A port of the Berkeley YACC parser-generator to Rust

License: MIT License

Shell 0.57% C 89.95% Makefile 0.08% C++ 0.12% Rust 5.05% Module Management System 0.03% DIGITAL Command Language 0.20% Yacc 3.45% Roff 0.41% SWIG 0.14%

racc's Introduction

RACC -- Rust Another Compiler-Compiler

A port of the Berkeley YACC parser-generator to Rust

racc is a Rust procedural macro (proc-macro) that allows crates to embed LALR(1) grammars in Rust source code.

How do I use it?

Look at racc/examples/math.rs for a brief example of how to write a grammar.

What do I do for a lexer?

nom is probably your best bet, for now.

But, why??

I've always loved yacc, and I first ported yacc to Rust as a syntax extension, years ago. This project is mostly an exercise in porting things to Rust, and seeing what the results are. If it's useful to anyone, then it's useful, and if it's not -- well, it's just anothere repo, rotting on Github, bothering no one.

Part of the exercise of this port is seeing how C idioms translate into Rust idioms. I find that porting code to Rust almost invariably clarifies the underlying algorithms, because concepts like slices and vectors much more clearly express the intent of an algorithm than C pointers do.

There are better packages out there, so just give up.

Sure, that's fine. Do whatever you want.

These packages do some or all things better than racc:

Limitations

There are lots of limitations and incomplete aspects of this, unfortunately. Finding them is left an exercise to the reader.

Author

RACC was implemented by Arlie Davis [email protected]. I did this as an experiment in porting a well-known (and useful) tool to Rust. I was also intrigued by Rust's support for procedural macros, and I wanted to see whether I could implement something interesting using procedural macros.

Feedback

Feel free to send me any feedback on RACC to [email protected].

racc's People

Contributors

brandonchinn178 avatar geraldstanje avatar sivadeilra avatar

Watchers

 avatar  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.