Related articles |
---|
Hybrid LR and LL parser tools? brueni@csgrad.cs.vt.edu (Dennis Brueni) (1992-05-20) |
Parsing Roman numbers joe@erix.ericsson.se (1992-05-22) |
Re: Parsing Roman numbers byron@archone.tamu.edu (1992-05-23) |
Re: Parsing Roman numbers henry@zoo.toronto.edu (1992-05-24) |
Re: Parsing Roman numbers weberwu@inf.fu-berlin.de (1992-05-24) |
Re: Parsing Roman numbers Martin.Ward@durham.ac.uk (Martin Ward) (1992-05-26) |
Newsgroups: | comp.compilers |
From: | henry@zoo.toronto.edu (Henry Spencer) |
Keywords: | parse |
Organization: | U of Toronto Zoology |
References: | 92-05-119 92-05-126 |
Date: | Sun, 24 May 1992 00:36:46 GMT |
joe@erix.ericsson.se (Joe Armstrong) writes:
>Has anybody got a grammar (preferably yacc) for parsing roman numbers?
I don't understand why you need a parser for this. Roman numerals are
described by the regular expression
M*(CM|DC{0,3}|CD|C{0,3})(XC|LX{0,3}|XL|X{0,3})(IX|VI{0,3}|IV|I{0,3})
(using POSIX 1003.2 regular-expression notation) unless you want to write
in a requirement that they be non-null, which would take a slightly more
complex form to deal with the requirement that at least one of the parts
be non-empty. Variations in notation, like allowing VIIII (which was
legitimate Roman practice at one time) are trivial to accommodate.
>Are they LL(k) LR(k) or what?
Since they can be described by a regular expression, they can be parsed
by a regular grammar, which is a still more restricted form. So the
answer is "all of the above".
--
Henry Spencer @ U of Toronto Zoology, henry@zoo.toronto.edu utzoo!henry
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.