CS 3304: Comparative Languages |
Semantics |
[ Course Documents ] : [ Semantics ] | ||||||||
|
<digit> -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 <dec_num> -> <digit> | <dec_num><digit>
Mdec('0') = 0, Mdec('1') = 1, ..., Mdec('9') = 9
Mdec(<dec_num>) =
case <dec_num> of <digit> => Mdec(<digit>) <dec_num><digit> => 10 x Mdec(<dec_num>) + Mdec(<digit>)