Re: Grammar for roman numerals

Hans-Peter Diettrich <DrDiettrich1@aol.com>
1 Apr 2007 08:56:07 -0400

          From comp.compilers

Related articles
Grammar for roman numerals msully4321@gmail.com (2007-03-27)
Re: Grammar for roman numerals martin@gkc.org.uk (Martin Ward) (2007-03-29)
Re: Grammar for roman numerals boldyrev+nospam@cgitftp.uiggm.nsc.ru (Ivan Boldyrev) (2007-03-29)
Re: Grammar for roman numerals mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2007-03-30)
Re: Grammar for roman numerals martin@gkc.org.uk (Martin Ward) (2007-03-30)
Re: Grammar for roman numerals mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2007-04-01)
Re: Grammar for roman numerals DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-01)
Re: Grammar for roman numerals alex.habar.nam@gmail.com (whiskey) (2007-04-06)
Re: Grammar for roman numerals dickey@saltmine.radix.net (Thomas Dickey) (2007-04-06)
Re: Grammar for roman numerals mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2007-04-06)
Re: Grammar for roman numerals DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-08)
| List of all articles for this month |

From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: 1 Apr 2007 08:56:07 -0400
Organization: Compilers Central
References: 07-03-095 07-03-107 07-03-119
Keywords: parse
Posted-Date: 01 Apr 2007 08:56:07 EDT

Martin Ward wrote:


> Taking the most liberal interpretation of the rule "a smaller number
> placed before a larger numeral should be subtracted from it,
> instead of added to it", every string of numerals has a valid interpretation.
> For example, "IXM" is interpreted as as IX (9) subtraced from M (1000)
> to give 991.


That's my understanding as well. Nonetheless I'm not sure of the full
algorithm, with regards to the total sum.


What about "IXIM"? Intuitively this would be 990 (-(-I+X+I)+M), but it
might be calculated as (-I+X)+(-I+M) = 1008 as well.


Similarly: "IXX" vs. "XIX", where "IX" is a smaller number, and "XI" is
not a smaller number, than the following numeral "X".




> This method has the advantage of providing representations for zero
> and negative numbers: for example VVX is one representation of zero,
>
> If only the Romans had followed the Robustness Principle, they might
> have discovered zero and negative numbers, and changed the course
> of mathematical history!


Great ideas :-)


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.