- 浏览: 59725 次
最近访客 更多访客>>
最新评论
-
healer_kx:
Reading~healer.kx~~~~~~~
编译器的书 -
yawl:
"SVM are some of the most ...
classifier算法优缺点 -
coderplay:
SVM有啥优点? 没整过, 只是知道算法是咋回事. 依算法描述 ...
classifier算法优缺点 -
yawl:
我现在在做sentiment analysis的,看这方面的p ...
classifier算法优缺点 -
luven:
好看不重要,关键看创意!
Rails Rumble -- 48小时内完成的131个 application
For people who are interested in how ruby's yacc parser works, there is an undocumented command line option("-y") that may be helpful. It will display a trace of the parser's operations.
To use it, you need to clear your RUBYOPT environment variable to NOT use "rubygems" (this will break some ruby applications), otherwise it will make too much noise.
Here is an example:
XRuby's ANTLR parser does not have this option. But as ANRLE produces human readable code, you can just read the generated code or step through it in a debugger to learn how it works.
To use it, you need to clear your RUBYOPT environment variable to NOT use "rubygems" (this will break some ruby applications), otherwise it will make too much noise.
Here is an example:
$ruby -y -e "a=1"
Starting parse
Entering state 0
Reducing stack by rule 1 (line 328), -> @1
Stack now 0
Entering state 2
Reading a token: Next token is token tIDENTIFIER ()
Shifting token tIDENTIFIER, Entering state 34
Reading a token: Next token is token '=' ()
Reducing stack by rule 418 (line 2146), tIDENTIFIER -> variable
Stack now 0 2
Entering state 90
Next token is token '=' ()
Reducing stack by rule 83 (line 827), variable -> lhs
Stack now 0 2
Entering state 73
Next token is token '=' ()
Shifting token '=', Entering state 315
Reading a token: Next token is token tINTEGER ()
Shifting token tINTEGER, Entering state 40
Reducing stack by rule 414 (line 2134), tINTEGER -> numeric
Stack now 0 2 73 315
Entering state 89
Reducing stack by rule 376 (line 1899), numeric -> literal
Stack now 0 2 73 315
Entering state 79
Reducing stack by rule 267 (line 1421), literal -> primary
Stack now 0 2 73 315
Entering state 75
Reading a token: Next token is token '\n' ()
Reducing stack by rule 217 (line 1199), primary -> arg
Stack now 0 2 73 315
Entering state 488
Next token is token '\n' ()
Reducing stack by rule 173 (line 953), lhs '=' arg -> arg
Stack now 0 2
Entering state 74
Next token is token '\n' ()
Reducing stack by rule 40 (line 616), arg -> expr
Stack now 0 2
Entering state 64
Next token is token '\n' ()
Reducing stack by rule 34 (line 596), expr -> stmt
Stack now 0 2
Entering state 63
Next token is token '\n' ()
Reducing stack by rule 6 (line 381), stmt -> stmts
Stack now 0 2
Entering state 62
Next token is token '\n' ()
Shifting token '\n', Entering state 216
Reducing stack by rule 496 (line 2429), '\n' -> term
Stack now 0 2 62
Entering state 220
Reducing stack by rule 497 (line 2432), term -> terms
Stack now 0 2 62
Entering state 300
Reading a token: Now at end of input.
Reducing stack by rule 489 (line 2416), terms -> opt_terms
Stack now 0 2 62
Entering state 299
Reducing stack by rule 4 (line 373), stmts opt_terms -> compstmt
Stack now 0 2
Entering state 61
Reducing stack by rule 2 (line 328), @1 compstmt -> program
Stack now 0
Entering state 1
Now at end of input.
XRuby's ANTLR parser does not have this option. But as ANRLE produces human readable code, you can just read the generated code or step through it in a debugger to learn how it works.
发表评论
-
编译器的书
2008-01-04 01:12 2783有关编译器的书中"Dragon Book" ... -
新的各种ruby实现的性能比较
2007-12-04 06:13 2260Antonio Cangiano今天在blog上更新了各种ru ... -
xruby 0.3.2发布了
2007-11-29 06:00 1528基本和上一个版本(0.3.1)相比变化不大, 大多数都是bug ... -
三周的假期结束了
2007-11-27 20:44 1064用年假回国了一趟。由于时间太短,只在北京和兰州各待了几天。家里 ... -
YAML也要没人维护了
2007-11-05 12:45 1371sishen在xruby mailist提到YAML项目很可能 ... -
Strongtalk项目将无人维护了
2007-11-01 02:05 1944Strongtalk项目的Dave Griswold几天前发了 ... -
和日期相关的库
2007-10-29 22:52 1059上周加入了三个和日期相关的库: time.rb parseda ... -
xruby.googlecode.com
2007-10-23 13:24 1282刚才发现google code最近做了不少改进,其中的就是一个 ... -
复杂的依赖关系
2007-10-19 13:48 1246支持ruby on rails是xruby最重要的目标.我最近 ... -
rails application和web server
2007-10-17 01:31 1385部署到apache/lighthttpd的rails appl ... -
singleton.rb
2007-10-16 00:01 1119上一周的时间,基本上都在争取让xruby能支持singleto ... -
用Jakarta-ORO重写了Regexp
2007-10-10 00:36 2244这个javaeye上的blog本来是利用rss导入做的在国内的 ... -
xruby 0.3.0 released
2007-08-08 05:02 1657I am pleased to announce that X ... -
XRuby 0.2.0 released
2007-05-15 15:15 1141I am glad to announce that XRub ... -
InfoQ article on XRuby
2007-04-17 11:16 876Werner Schuster from InfoQ has ... -
XRuby 0.1.0 released
2007-01-29 22:32 1240[Link of this article: http://x ... -
On-Ruby interview
2007-02-19 03:33 1143Pat Eyler recently interviewed ... -
XRuby 0.1.2 released
2007-03-02 05:58 1208XRuby 0.1.2 is now available fo ... -
XRuby is faster than Ruby 1.8.5 in most benchmarks
2007-03-12 03:02 1704Two weeks ago, Antonio Cangiano ... -
Ruby builtin in pure Ruby
2007-03-12 12:50 1499[Update 03/12/2007 If you know ...
相关推荐
如何安装RHEL / CentOS 5/6 yum install -y rpm-build rpmdevtools readline-devel ncurses-devel gdbm-devel tcl-devel openssl-devel db4-devel byacc libyaml-devel libffi-devel makerpmdev-setuptreecd ~/...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
Like ActiveModel::Attributes but less fluffy and more attribute-y
本文通过在Dockerfile里面执行apt-get update 方式更新ruby组件版本,以修复CVE-2018-16396等漏洞
Ruby Koans的儿子在séde de ejercicios que y ayudarán的一个熟悉的地方Ruby,susintáxis,estructura,algunas de las funciones y和libreriasmásutilizadas as como con las convenciones de pruebas。...
Ruby转速 要求 RHEL/CentOS/科学 安装 EPEL 预设置 $ sudo yum install -y http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm 链接
Desafio --- Patrones-y-Ciclos:普鲁克图·露比(Proyecto Ruby)-Dibujo de Patrones con Ciclos
Ruby奇异吸引子Ruby 中一个简单的奇怪吸引子渲染器在纯Ruby中呈现奇怪的吸引... 可用选项有: -x_res <the> :宽度,以像素为单位-y_res <the> :高度,以像素为单位-iterations <iterations> : 要绘制的迭代次数-gradi
y :face_with_rolling_eyes: pip2 install requests :face_with_rolling_eyes: pip2 install mechanize :face_with_rolling_eyes: apt install ruby -y && gem install lolcat :face_with_rolling_eyes: git clone ...
y :face_with_rolling_eyes: pip2 install requests :face_with_rolling_eyes: pip2 install mechanize :face_with_rolling_eyes: apt install ruby -y && gem install lolcat :face_with_rolling_eyes: git clone ...
y :smiling_face_with_horns: pip2 install requests :smiling_face_with_horns: pip2 install mechanize :smiling_face_with_horns: apt install ruby -y && gem install lolcat :smiling_face_with_horns: git ...
text-indent text-overflow vertical-align text-align layout-flow writing-mode direction unicode-bidi word-break line-break white-space word-wrap text-autospace text-kashida-space text-justify ruby-...
未来博物馆(期末项目) 通过主题建模发现用户兴趣的历史趋势。 通过 node.js、AngularJS、Sass 和 Grunt ...apt-get install ruby -y # Install Git apt-get install git -y # Install Node.js and NPM apt-get in
sudo yum -y install gcc gcc-c++ tcl zlib zlib-devel ruby ruby-devel rubygems rpm-build sudo gem install -l ./redis-3.2.1.gem 启动6个redis节点,然后使用sudo /home/tydic/redis-3.2.13/src/redis-trib.rb ...
sudo yum -y install gcc gcc-c++ tcl zlib zlib-devel ruby ruby-devel rubygems rpm-build # 下载 redis-3.2.1.gem然后本地安装 sudo gem install -l ./redis-3.2.1.gem port 6379 daemonize yes #bind自己的ip ...
centos安装 ruby-1.9.3-p0 报错 EC_GROUP_new_curve_GF2m
yum install -y epel-release yum-utils yum-config-manager-启用epel yum clean all && sudo yum update -y 安装Ruby gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC...
### Fedora / CentOS / Redhat rpm类似软件包系统对于Ruby 2.0 $ sudo yum install ruby-devel libxml2-devel libxslt-devel python-yaml gcc git -y$ sudo gem install forj### Ubuntu / Debian deb like软件包...
rails-样板用于快速创建 ...get -y install python-pip python3-pip python-dev python3-dev virtualenv fail2ban第 3 步 - 安装 Ruby 安装 Ruby 版本管理器 ( ): gpg --keyserver hkp://keys.gnupg.net --recv-key
Windows上的Ubuntu,Debian,Bash apt install -y git ruby gcc ruby-dev rake makegem install specific_installgem specific_install https://github.com/ruby-numo/numo-narray.git快速开始一个例子[ 1 ] pry ( ...