Commit Graph

51 Commits

Author SHA1 Message Date
Brandon Amos
22b3e71623 Add stdexcept for domain_error. 2016-02-26 20:51:28 -05:00
Brandon Amos
19b56e6629 Add Travis badge to the README. 2016-02-26 17:57:37 -05:00
Brandon Amos
d905c2f172 Makefile: run->test 2016-02-26 17:56:04 -05:00
Brandon Amos
e0322417f8 Update .travis.yml 2016-02-26 17:55:59 -05:00
Brandon Amos
a6216ecf5d Remove trailing newlines and spaces.
\cc @VinGarcia
2016-02-26 17:50:20 -05:00
Brandon Amos
f01336fa5a Remove unused CMakeLists. 2016-02-26 17:49:49 -05:00
Brandon Amos
63de713776 Merge pull request #10 from VinGarcia/master
Add a compile() feature to class instance
2016-02-26 17:48:47 -05:00
Vinícius Garcia
3f80b27bdc Make it accept variable names with numbers, e.g. a1 2016-02-26 01:59:21 -03:00
Vinícius Garcia
1d0cfc0d60 Improve Makefile with a make run command 2016-02-26 01:26:25 -03:00
Vinícius Garcia
9750682c9c Modify calculate() for lazy variable evaluation
Now it is possible to precompile an expression without
binding all its variable values. And bind them only
when the expression will be evaluated.

This way different evaluations of a single expression
may have different sets of variables.

This method optimizes the case when you need to re-evaluate
a single equation several times in different contexts.
2016-02-26 01:24:57 -03:00
Vinícius Garcia
ef5b5d2f22 Add non static functions: compile() and eval()
With this commit the class can now be instantiated.
It now has a constructor and a destructor.

The Compile function will read an expression,
produce an RPN, and save it on this->RPN.

Eval will evaluate this->RPN only when asked for.

The calculator::str() function was added to simplify
the debugging process.
2016-02-26 01:15:08 -03:00
Vinícius Garcia
af9cc8b07e Define opPrecedence as static class member
It was done for better modularization:
1. Now it does not have to be rebuilt everytime calculate runs.
2. Now it can be added as an optional default argument of
   `toRPN()` function, simplifying it's calls.
2016-02-25 23:35:02 -03:00
Brandon Amos
0faa25ea56 Remove biicode and CI. 2016-02-09 11:39:15 -05:00
Brandon Amos
813a6b24c2 Move badge to the top of the README. 2015-10-18 13:13:25 -04:00
Brandon Amos
cadce05e0d Merge pull request #9 from redpois0n/master
Support modulo
2015-07-23 15:13:19 -04:00
redpois0n
1e30ea140e Update shunting-yard.cpp 2015-07-23 21:10:36 +02:00
redpois0n
36ff7f8fef Update shunting-yard.cpp 2015-07-23 21:04:51 +02:00
Brandon Amos
f3e9bd8b54 Merge pull request #7 from MariadeAnton/biicodizer
added CI files
2015-02-16 11:16:37 -05:00
mariadeanton
a606f18161 added CI files 2015-02-16 15:01:24 +01:00
Brandon Amos
5af36331e7 Merge pull request #6 from MariadeAnton/biicodizer
added unobtrusive changes to work with biicode
2015-02-09 10:52:23 -05:00
mariadeanton
8196b7424f added unobtrusive changes to work with biicode 2015-02-09 15:32:43 +01:00
Brandon Amos
271d435078 Formatting and header. 2015-01-28 18:51:31 -05:00
Brandon Amos
900395c489 Merge pull request #5 from veroight/patch-1
add "^" op
2015-01-28 18:50:15 -05:00
veroight
369c1b588d add "^" op 2015-01-28 23:06:50 +00:00
Brandon Amos
1aff34f526 Add link to biicode. 2014-12-30 11:16:03 -05:00
Brandon Amos
97255a665c Typo. 2014-12-19 11:21:37 -05:00
Brandon Amos
12c1536af0 Fix code blocks. 2014-09-13 18:45:04 -04:00
Brandon Amos
d64d6cd4c9 Update README. 2014-09-13 18:44:21 -04:00
Brandon Amos
5b189bf332 Move license. 2013-07-22 08:31:57 -07:00
Brandon Amos
eb60cdea34 Update README.md 2013-07-17 00:22:37 -04:00
Brandon Amos
b7b7b8d27b Add license. 2013-06-24 22:27:28 -07:00
Brandon Amos
9cbaf00a51 Update README. Fix bug with unary operators/operator parsing. 2013-06-21 14:41:14 -07:00
Brandon Amos
9174a0571b Add support for unary operators. 2013-06-21 14:34:49 -07:00
Brandon Amos
f21cf3d1aa Update comments. Refactors to eliminate the ShuntingYard class. 2013-06-21 14:12:55 -07:00
Brandon Amos
eea9c17dd0 Small changes. 2013-06-21 10:57:24 -07:00
Brandon Amos
021b10d6f8 Improve error checking. 2013-06-21 10:51:21 -07:00
Brandon Amos
a272eaeaeb Replace RPNExpression with std::queue. 2013-06-21 10:41:07 -07:00
Brandon Amos
1d7e56285d Small-scale code refactors, improvements, and comments. 2013-06-21 10:30:40 -07:00
Brandon Amos
b11856d39c Remove minimal example code. 2013-06-13 21:18:58 -07:00
Brandon Amos
ef9d05c9b6 Remove binary... 2013-06-12 17:14:22 -07:00
Brandon Amos
23d82d0a73 Fix code in README. 2013-06-11 21:03:53 -07:00
Brandon Amos
652e347e98 Tweak README. Fix imports. 2013-06-11 06:34:01 -07:00
Brandon Amos
c048bb8108 Add test cases and Makefile. 2013-06-11 06:25:37 -07:00
Brandon Amos
4a74b4adb1 Update README. 2013-06-11 00:20:09 -07:00
Brandon Amos
a78f382615 Add support for variables with a string->double map. 2013-06-11 00:17:10 -07:00
Brandon Amos
1a0e28ef64 Make calculate static and fix operator precedence. 2013-06-11 00:16:38 -07:00
Brandon Amos
ac1f2185ca Update README. 2013-06-08 13:06:29 -07:00
Brandon Amos
a28552dfd4 Remove tabs. 2013-06-07 21:31:16 -07:00
Brandon Amos
8338eda5f2 Add README. 2013-06-07 03:56:55 -07:00
Brandon Amos
add2da70de Tweak the Shunting-yard algorithm and add support for bitshifts. 2013-06-07 03:55:05 -07:00