EBNF for Ruby?

S

Sam Kong

Hi,

I heard from somebody that Ruby cannot be completely expressed in EBNF.
And he also said that there are some ad hoc cases.
Is it true?

Sam
 
L

Logan Capaldo

Hi,

I heard from somebody that Ruby cannot be completely expressed in EBNF.
And he also said that there are some ad hoc cases.
Is it true?
Check out parse.y (the yacc grammar for ruby) and see for yourself.
However, yes there are ad-hoc cases, mostly invovlving parentheses that
probably can not be expressed as a CFG.
 
T

Tomasz Wegrzanowski

Hi,

I heard from somebody that Ruby cannot be completely expressed in EBNF.
And he also said that there are some ad hoc cases.
Is it true?

If you want to parse Ruby, your best bet is probably ParseTree :) [1]
[1] http://www.zenspider.com/ZSS/Products/ParseTree/

Examples of difficult cases:
foo { } # calls foo with empty hash or with empty block ?

foo + # Newlines are ignored when the expression is "not complete"
bar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,215
Messages
2,571,113
Members
47,710
Latest member
HarleyMoli

Latest Threads

Top