I am trying to write a parser for a subset of C.
The behavior of treetop is difficult to analyze on this simple (further simplified) grammar.
grammar Shyc
rule functionDef
type space identifier '(' ')' bloc
end
rule type
'int'
end
rule bloc
'{' '}'
end
rule identifier
[a-zA-Z] [a-zA-Z_]*
end
rule space
[\s]+
end
end
My test case is "int main(){}"
And the error message from treetop is :
error at line 1, column 9
failure reason : Expected [a-zA-Z_] at line 1, column 9 (byte 9) after
compiler.rb:25:in `parse': Parse error (RuntimeError)
from compiler.rb:73:in `<main>'enter
The problem is thus around identifier rule...
The version of treetop : 1.5.3 and Ruby 2.1.1
Any idea ?