**Parser For expr Command** %|||% &|Areas | Language parsing, computer arithmetic |& &|Good if student knows | variable, based on interests |& &|Priority | Low |& &|Difficulty | low to medium |& &|Benefits to the student | introduction to grammar and parsing concepts |& &|Benefits to Tcl | Leverage ease of use of existing tools |& &|Mentor | [Steve Huntley] |& **Project Description** [Perl] enables arbitrary precision math by means of a pragma, which overloads the standard math operators and thus transparently accepts large integers as arguments for mathematical expressions. In this way Perl is able to do not only large integer math transparently as Tcl does, but also floating-point, rational number, vector, etc. calculations [http://perldoc.perl.org/bignum.html] [http://perldoc.perl.org/bigrat.html]. This approach could not work with Tcl, since it does not have math operators per se, but instead has the command [expr] with its own syntax for math expressions. However, it should be straightforward to overload the expr command itself; with a command that is able to parse existing valid math expressions, and can be expanded to accept a wider range of operations. The goal of this project would be to write a selection of parsers/lexers for mathematical expressions, and incorporate them into a replacement for the expr command, thus allowing for transparent use of a wider range of numerical types (similar to Perl's usage), and experiments on new ways to execute expressions that are currently valid, such as: * compiling to C statements and executing via [critcl] * compiling to bytecode using methods outlined by [KBK] [http://www.tclcommunityassociation.org/wub/proceedings/Proceedings-2010/KevinKenny/assembler.pdf] * automatic interfacing to graphing functions The exact mix of features would be dependent on the skills and interests of the student. Existing pure-Tcl parsing tools such as [Yeti] or [taccle] should be suitable for the task. Evaluation of parser features and selection of tools would be part of the project. **Requirements:** * flexible * incorporate the Tcl expr patch allowing us to eliminate the dereferencing operator and outer braces? Please? Finally? allowing [ expr x*x ] instead of [ expr {$x*$x} ] <>GSoC