What do you recommend to parse Ruby in Ruby?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
I want to parse a language like Ruby/JavaScript, where the ";" at the end of statement can be omitted if the string ends.

At the same time, arrange the blanks in each place the rules where they are (space) may meet I would not like (Citrus).

The effectiveness of the execution of the code is unimportant, rather you want speed, simplicity and elegance when writing rules and event handlers.
by | 52 views

3 Answers

0 like 0 dislike
the first links in Google:
lex — raa.ruby-lang.org/project/ruby-lex/
yacc — i.loveruby.net/en/projects/racc/
grammar in bnf — www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf
and I recommend to start to read this book ru.wikipedia.org/wiki/%D0%9A%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%82%D0%BE%D1%80%D1%8B:_%D0%BF%D1%80%D0%B8%D0%BD%D1%86%D0%B8%D0%BF%D1%8B,_%D1%82%D0%B5%D1%85%D0%BD%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D0%B8_%D0%B8_%D0%B8%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D1%8B
0 like 0 dislike
What do you need?
You were given a lexical analyzer generator, parser generator, grammar which they need to feed and a book, which explains how, why and what to do.
0 like 0 dislike
One friend has already implemented the parser https://github.com/whitequark/parser that gives ast

Related questions

110,608 questions
257,186 answers
27,964 users