# Treetop question

**URL:** <https://www.ruby-forum.com/t/treetop-question/147032>\
**Category:** Ruby\
**Created:** [August 27, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/treetop-question/147032 "2008-08-27T19:49:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lpc2148](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9de053/32.png) [@lpc2148](https://www.ruby-forum.com/u/lpc2148)\
**Post date:** [August 27, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/treetop-question/147032/1 "2008-08-27T19:49:15Z")

</div>

Hi guys !

I started to learn to use treetop , so I would have a question :

if I create a grammar this way :

grammar Tester  
rule basic  
([a-f] [a-f] [a-f] [a-f] [a-f]) {  
def val  
text\_value  
end  
}  
end  
end

and use it in the following code :  
require “rubygems”  
require “treetop”  
Treetop.load “tester”

parser = TesterParser.new  
puts parser.parse(“abcde”).val

I get the following error : x.rb:6: undefined method `val’ for  
#Treetop::Runtime::SyntaxNode:0xb7ccd4b0 (NoMethodError) . However ,  
if I replace this :

([a-f] [a-f] [a-f] [a-f] [a-f])

with

([a-f] [a-f] [a-f] [a-f] [a-f] / ‘’)

then everything works . Could you explain why this happens ?
