Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

thought it would be fun to write this in raku

  grammar Arithmetic {
    rule TOP       { ^ <expr>       $ }
    rule expr      { <term>+ % ['+' | '-'] }
    rule term      { <value> }
    rule value     { <number> | <parens> }
    rule number    { \d+ }
    rule parens    { '(' <expr> ')' }
  }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: