Create a Roman Numeral calculator
JavaScript (ES6), 238

c=s=&gt;{X={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}
n=eval('W='+s.replace(/[\w]+/g,n=&gt;(o=0,n.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,d=&gt;o+=X[d]),
o+';W=W')));o='';for(i in X)while(n&gt;=X[i])o+=i,n-=X[i];return o}


Usage:

c("XIX + LXXX")
&gt; "XCIX"
c('XCIX + I / L * D + IV')
&gt; "MIV"


Annotated version:

/**
 * Process basic calculation for roman numerals.
 * 
 * @param {String} s The calculation to perform
 * @return {String} The result in roman numerals
 */
c = s =&gt; {
  // Create a lookup table.
  X = {
    M: 1e3, CM: 900, D: 500, CD: 400, C: 100, XC: 90, 
    L: 50,  XL: 40,  X: 10,  IX: 9,   V: 5,   IV: 4, I: 1
  };
  // Do the calculation.
  // 
  // The evaluated string is instrumented to as below:
  //   99+1/50*500+4 -&gt; W=99;W=W+1;W=W/50;W=W*500;W=W+4;W=W
  //                 -&gt; 1004
  n = eval('W=' + s.replace(
    // Match all roman numerals.
    /[\w]+/g,
    // Convert the roman number into an integer.
    n =&gt; (
      o = 0,
      n.replace(
        /[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,
        d =&gt; o += X[d]
      ),
      // Instrument number to operate left-side operations.
      o + ';W=W'
    )
  ));

  // Convert the result into roman numerals.
  o = '';
  for (i in X)
    while (n &gt;= X[i])
      o += i,
      n -= X[i];

  // Return calculation result.
  return o
}