From: Lex Williams Date: 2008-08-30T03:48:40+09:00 Subject: Re: how can I debug treetop grammar? Would you please walk me through a debugging example ? Considering this grammar : grammar Dp rule all day space month { def value day.value.to_s + " " + month.value end } end rule day [1-9] [1-9] / "" { def value text_value.to_i end } end rule space ' '* end rule month "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" / "" { def value text_value end } end end and the following code : equire "rubygems" require "treetop" Treetop.load "dp" parser = DpParser.new node = parser.parse("12") another = parser.parse("Feb") lastone = parser.parse("12 Feb") puts node.value puts another.value puts lastone.value ------------------------------------------------------------------------------- i'm getting back syntax nodes , but I can't call value on any of them . could you please show me how you would debug the rules ? hope I'm not asking for too much ! Thanks , Lex -- Posted via http://www.ruby-forum.com/.