Calculator using variable names

I’ve recently been assigned an assignment to create a word calculator, and given my knowledge in python is still quite lacking, I want to ask if anybody has any better ideas for any possible solutions. The question is here: Jimmy has invented a new kind of calculator that works with words rather than numbers. Input … Read more

RPN-Stack-Based Recursive Calculator Needs Tuneup

This function takes an array of strings and numbers and recursively processes it as a kind of “calculating program”. The structure is based on Reverse Polish Notation, so the top object in the stack (last in the array) determines what to do with the next one (or two) items in the program. For example, if … Read more

Calculator parsing S-expressions

The following program is supposed to be a (command line) calculator that parses expression following syntax similar to Lisp’s S-expressions. Some examples: $ echo “(+ 5 5)” | ./a.out 10.000000 $ echo “(+ (- 3 2) (* 9 2))” | ./a.out 19.000000 $ echo “(/ 24 6 2)” | ./a.out 2.000000 $ echo “(/ 24 … Read more

NASM RPN Calculator

I’ve been learning Assembly over the past few days, and I’ve made a simple RPN calculator. Here is the main logic of the program, excluding utility functions such as printing: %include “utilities.s” SECTION .data badOpMsg db “Unknown character: “, 0h badNumMsg db “Error parsing number: “, 0h badExprMsg db “Invalid expression supplied”, 0h SECTION .bss … Read more