Frage

Ich suche Ruby Grammar in BNF -Form. Ist dort ein offiziell Ausführung?

War es hilfreich?

Lösung

Ja es gibt eins Ruby BNF -Syntax von der Universität von Buffalo.

Bearbeiten: Ich habe diese Alternative auch gefunden Ruby BNF -Syntax.

Andere Tipps

Die YACC -Syntax befindet sich in der Rubinquelle. Laden Sie es herunter und führen Sie die gebündelte Utiliy aus, um die lesbare Syntax zu erhalten.

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

Ausgangsprobe (insgesamt 918 Zeilen für den 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
                ;

Auch eine offizielle Version: Ruby Draft Specification. Sie können die Grammatik dort finden.

Ruby -Entwurfsspezifikation: http://ruby-std.netlab.jp. Der Server ist ausgefallen, aber Sie können ihn herunterladenhttp://www.ipa.go.jp/osc/english/ruby

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top