Re: Flex or bison?

2010-09-19 Thread Hans Lodder
On 18-9-2010 10:34, Hans Aberg wrote: On 18 Sep 2010, at 09:15, Hans Lodder wrote: I am currently performing a Seach Engine Optimization (SEO) of HTML web-pages of my web-site (on Win XP Home SP3). In order to do that it is important to know, which 3 words are used most frequently on the page.

Optional rule throws shift/reduce conflict

2010-09-19 Thread anandvn
Hi, I'm new to bison and need help to acheive my following syntax, syntax1: decl_spec semicolon syntax2: decl_spec decl_attrib(optional) init_spec decl_attrib(optional) semicolon To achieve this i wrote bison grammar as, declaration: decl_spec semicolon |decl_spec decl_attrib in

Re: Optional rule throws shift/reduce conflict

2010-09-19 Thread John P. Hartmann
While Bison has only one token lookahead, it has infinite memory. If something is optional it is best to write two reduction rules. Though the combinations do grow exponentially. In your case: syntax1 : decl_spec ';' | decl_spec init_spec ';' | decl_spec init_spec decl_attrib ';' | decl_s