-
Notifications
You must be signed in to change notification settings - Fork 0
colm-mchugh/calcit
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
calcit - A simple command line interpreter for calculator expressions 1) To build and run: type make at the command-line, followed by ./calcit $ make $ ./calcit Note: Written in C using some C++ features. Built and tested on ubuntu 12.04. (GNU g++ 4.8.2, GNU bison 2.5, flex 2.5.35, GNU make 3.81) 2) About: 'calcit' is a simple command line interpreter for evaluating calculator expressions. You can enter any arbitrary arithmetic expression using the operators '+', '-', '*' and '/'. An expression can be saved in a variable and used later: > pi := 3.141 3.141000 > r := 12 12 > pi*r*r 452.304016 > Parentheses can be used to group sub-expressions: > 7 * 3 + 4 25 > 7 * (3 + 4) 49 Integer and float constants can be used in the same expression: > 1 + 1/2.0 1.500000 See calcit.example for examples. To run these examples, enter: $ ./calcit < calcit.example 3) Code details: The shell (shell.cpp) is the driver; it waits for input and then processes it using the following modules: (1) parser (parser_wrapper.h, parser.y, tokens.l) Input: text string Output: node tree (node.h) (2) analyzer (analyzer.h) Input: node tree Output: node tree and updated symbol table, or list of errors (3) evaluater (evaluater.h) Input: analyzed node tree Output: evaluated expression (ExprValue in context.h). A context object (context.h) is used to hold state for processing input (node tree, symbol table, evaluation functions, error list).
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published