Overview ^

This is an implementation of 'POSIX bc' for Parrot. 'bc' is an arbitrary precision calculator dating back from Unix stone age. See http://en.wikipedia.org/wiki/Bc_%28Unix%29 for details. This implementation is based on Python classes generated by ANTLR2 and Java classes generated by ANTLR3.

Why Parrot bc ^

Self education. A fairly simple language but has symbols and subroutines. Test for decimal bignum libraries. A starting point for more interesting languages like R, GDL, JavaScript.

Parrot bc with ANTLR 2 ^

Develoment has stalled.

The language grammar is in grammar/bc_python.g. ANTLR2 takes the grammar and generates Python classes for lexer, parser and tree parser. The driver program bc.py takes bc source and generates PIR. The generated PIR sets up a PAST data structure, and from there on Allison Randalls TGE takes over.

Parrot bc with ANTLR 3 ^

Under development.

Generate PIR that sets up a PAST data structure, that will be transformed to POST which will be transformed to PIR, which will be executed by Parrot. For details set 'languages/punie/punie.pir' and http://svn.lohutok.net/nam/trunk/parrot/docs/compiler_tools.pod

Vision ^

Use the Ruby code generation target of ANTLR3 and run with languages/ecmascript. Add a tree transformation step that generates an common tree AST that translates directly to PAST.

SEE ALSO ^

  L<http://en.wikipedia.org/wiki/Bc_%28Unix%29>
  L<http://www.opengroup.org/onlinepubs/000095399/utilities/bc.html>
  L<http://www.funet.fi/pub/doc/posix/p1003.2/d11.2/4.3>
  L<http://directory.fsf.org/gnu/bc.html>
  L<http://www.gnu.org/software/bc/manual/html_mono/bc.html>
  L<http://svn.lohutok.net/nam/trunk/parrot/docs/compiler_tools.pod>


parrot