|Parsing Roman numbers firstname.lastname@example.org (1992-05-22)|
|Re: Parsing Roman numbers email@example.com (1992-05-23)|
|Re: Parsing Roman numbers firstname.lastname@example.org (1992-05-24)|
|Re: Parsing Roman numbers email@example.com (1992-05-24)|
|Re: Parsing Roman numbers Martin.Ward@durham.ac.uk (Martin Ward) (1992-05-26)|
|From:||Martin Ward <Martin.Ward@durham.ac.uk>|
|Date:||Tue, 26 May 1992 11:15:29 GMT|
firstname.lastname@example.org (Henry Spencer) writes:
> Roman numerals are described by the regular expression
My dictionary mentions IIC as an allowed representation for 98, also _any_
lower numerals can be used before a larger numeral to indicate
subtraction, eg: MXM = 1990, IIM = 999. There's also the older
representations (I) for M (with ((I)) for 10,000, (((I))) for 100,000
etc.) and )( for X.
For translating Roman numerals to arabic I would allow any sequence of
MDCLXVI, work from left to right keeping a running total, when you hit a
larger numeral than the previous one, scan from right to left a suitable
number of places, subtracting _twice_ the value of the numerals scanned.
Converting this algorithm into a single-pass algorithm is simple.
Compiling from arabic to roman numerals is more difficult because there are
many roman numeral representations of the same arabic number.
JANET: Martin.Ward@uk.ac.durham Internet (eg US): Martin.Ward@durham.ac.uk
or if that fails: Martin.Wardemail@example.com
or even: Martin.Ward%DURHAM.AC.UK@CUNYVM.CUNY.EDU
BITNET: Martin.Ward%durham.ac.uk@UKACRL UUCP:...!uknet!durham!Martin.Ward
[Enough already. There's a zillion different variants of roman numbers,
and no formal definition. Unfortunately, the archives of the appropriate
National Standards Organization, the RISI (Roman Imperial Standards
Institute, formerly the RRSI) were lost when their impressive marble Hall
of Records collapsed due to a calculation error by the architect. -John]
Return to the
Search the comp.compilers archives again.