What do you recommend to parse Ruby in Ruby?

0 like 0 dislike
56 views
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 | 56 views

3 Answers

0 like 0 dislike
the first links in Google:
\r
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
\r
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
by
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.
by
0 like 0 dislike
One friend has already implemented the parser https://github.com/whitequark/parser that gives ast
by

Related questions

110,608 questions
257,186 answers
0 comments
28,707 users