Related articles |
---|
Help withh yacc date parser belgioioso@libero.it (Davide Rizzo) (2003-02-06) |
From: | "Davide Rizzo" <belgioioso@libero.it> |
Newsgroups: | comp.compilers |
Date: | 6 Feb 2003 00:05:47 -0500 |
Organization: | [Infostrada] |
Keywords: | yacc, parse, question |
Posted-Date: | 06 Feb 2003 00:05:47 EST |
I need to define some Bison rules to match an arbitrary sequence of date and
time specification eg:
"monday 13 18:45 and 19:30", "sunday 19 and december 1st 2003 19:45 and
20:45" etc.
To avoid the great amount of reduce/reduce conflicts I get defining each
rule in a recursive manner, I tried something like:
note: object date_time_specifications
| date_time_specifications object
;
date_time_specifications: date_specification
| time_specification
| date_time_specifications date_specification
| date_time_specifications time_specification
| date_time_specifications _AND date_specification
| date_time_specifications _AND time_specification
;
date_specification: date_specification dates
| date_specification _AND dates
| date_specification date_intervals
| date_specification _AND date_intervals
| date_specification dates _AND date_intervals
| date_specification date_intervals _AND dates
;
dates: date
| dates date
;
date: implicit_specified_date
| only_month
| day_and_month
| fully_specified_date
;
I would like to know (before defining action rules) if you think this
could work well
thanks, regards
Davide Rizzo
reply at belgioioso@libero.it
Return to the
comp.compilers page.
Search the
comp.compilers archives again.