Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
229 views

Infix calculator programming challenge Kattis.com

I'm working on this C++ coding problem: Input is a sequence of up to commands, one per line, ending at end of file. Each command is a definition, a calculation, or a clear. All tokens within a ...
circuital's user avatar
11 votes
2 answers
2k views

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....
Ruma Svenchko's user avatar
6 votes
1 answer
8k views

Use Infix expression to construct a binary expression tree

Problem statement Construct a binary expression using infix expression. The infix expression uses extra parenthesis to enforce the priority of operators. For example, infix expression ...
Jianmin Chen's user avatar
  • 2,456
3 votes
2 answers
985 views

CodeWars - Three-pass compiler for arithmetic expressions

I'm looking for feedback on my solution to the Tiny Three-Pass Compiler kata on CodeWars. The kata is to implement a compiler for an arithmetic language in three passes - parsing to an AST, constant ...
DylanSp's user avatar
  • 193
5 votes
2 answers
4k views

Evaluating a completely parenthesized arithmetic expression

I tried to solve the following problem in a programming challenge, but the verdict was time limit exceeded. Completely parenthesized expression Write a program that reads a completely ...
JnxF's user avatar
  • 723
8 votes
3 answers
1k views

CodeWars mathematical expresion evaluator

I recently wrote the following code for a codewars.com kata for evaluating mathematical expressions. I've been writing ruby for years, but almost everything I do is for personal use and isn't shared,...
Zack's user avatar
  • 1,903
4 votes
1 answer
2k views

Ad-hoc lexical scanner for a calculator language

Challenge: Build an ad-hoc scanner for a calculator language. Specifications: The tokens for the language are as follows: assign → := plus → + minus → - times → * div → / lparen → ( rparen → ) id →...
Legato's user avatar
  • 9,929
5 votes
1 answer
118 views

Basic Reverse Polish CL Parser

K and R Exercise 5-10 Write the program expr, which evaluates a reverse Polish expression from the command line, where each operator or operand is a separate argument. For example, <...
albertjorlando's user avatar