Still playing with Marpa. Recently released a small utility to calculate dates: https://metacpan.org/pod/App::datecalc
The calculator allows writing date literals in the form of YYYY-MM-DD, e.g. 2014-05-20. Other allowable literals include date duration in the form of ISO 8601 notation (e.g. P1Y2M3D) or natural (e.g. "1 year 2 months 3 days"). I'm also trying to add some numeric arithmetics capability to the calculator, so it can do simple arithmetics on numbers e.g. '2014 - 10' (2004) or '3*2 * P1D' (meaning 6 times the duration of 1 day). And that's where I'm currently stuck. My latest attempt at the time of this writing: https://github.com/sharyanto/perl-App-datecalc/commit/3df0bd0cc681be7bd3a535469ac0fbe439df7deb If I define op_addsub ~ [+-] then Marpa will treat a date literal '2014-05-20' as subtraction operation, yielding 1979. If I require whitespaces around the subtraction operator (i.e. op_addsub ~ [+] | ' - ') then Marpa will refuse to parse '1-2' (no whitespaces around the minus sign). Moreover, DATE-DATE (subtraction of two dates) doesn't work anymore. Pointers are very much appreciated. Regards, Steven -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
