Gramática en Ruby


Estoy buscando gramática Ruby en forma BNF. ¿Existe una versión oficial ?

Author: user68109, 2009-03-19

3 answers

Sí, hay una sintaxis Ruby BNF de la Universidad de buffalo.

Editar: También he encontrado esta sintaxis alternativa Ruby BNF.

 14
Author: Adrian Grigore,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-10-15 02:14:03

La sintaxis de YACC está en la fuente Ruby. Descárguelo y ejecute el utiliy incluido para obtener la sintaxis legible.

wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz
tar xvzf ruby-2.0.0-p195.tar.gz
cd ruby-2.0.0-p195
ruby sample/exyacc.rb < parse.y

Muestra de salida (total 918 líneas para el v2.0.0-p195)

program         : top_compstmt
                ;

top_compstmt    : top_stmts opt_terms
                ;

top_stmts       : none
                | top_stmt
                | top_stmts terms top_stmt
                | error top_stmt
                ;

top_stmt        : stmt
                | keyword_BEGIN
                  '{' top_compstmt '}'
                ;

bodystmt        : compstmt
                  opt_rescue
                  opt_else
                  opt_ensure
                ;

compstmt        : stmts opt_terms
                ;
 28
Author: Kenji Noguchi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-05-18 22:05:33

También una versión oficial: Ruby Draft Specification. puedes encontrar la gramática allí.

Especificación del borrador de Ruby: http://ruby-std.netlab.jp. el servidor está caído, pero puede descargarlo desde http://www.ipa.go.jp/osc/english/ruby

 5
Author: GutenYe,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-31 01:54:51