Z
Z
zencd2010-12-08 15:11:57
ruby
zencd, 2010-12-08 15:11:57

How do you recommend parsing Ruby to Ruby?

I want to parse a language like Ruby/JavaScript, where ";" at the end of the statement can be omitted if the line immediately ends. At the same time, it would be very undesirable to place
spaces in each place of the rules where they (spaces) may occur (Citrus).
Efficiency of code execution is not important; rather, speed, simplicity, and elegance are required when writing rules and event handlers.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
retran, 2010-12-08
@retran

first links in google:
lex - raa.ruby-lang.org/project/ruby-lex/
yacc - i.loveruby.net/en/projects/racc/ bnf
grammar - www.cse.buffalo.edu/ ~regan /cse305/RubyBNF.pdf
and I recommend reading this book first - en.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

R
retran, 2010-12-08
@retran

What do you need?
You were given a generator of lexical analyzers, a generator of parsers, a grammar that they need to feed and a book that says how, what and why to do.

F
fatumka, 2013-12-22
@fatumka

One friend has already implemented a parser - https://github.com/whitequark/parser, produces ast

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question