← Back to Portfolio

Arithmetic Expression Evaluator

csharpMar 2026Solo Developer

Project Overview

A .NET 9 console application that reads infix expressions from an XML file, converts each one to prefix and postfix notation, and evaluates both forms by building and compiling LINQ Expression Trees. It checks that the prefix and postfix results match, prints a summary table to the console, and generates a styled HTML report.

Demo Video

Key Features

  • Deserializes the input expressions from an XML file with System.Xml.Serialization
  • Infix to postfix conversion with Dijkstra's shunting-yard algorithm
  • Infix to prefix conversion using the reverse-then-shunting-yard technique
  • Builds and compiles LINQ Expression Trees to evaluate both prefix and postfix forms
  • Compares the two results and writes a console summary table plus an HTML report via StreamWriter extension methods

Technical Challenges & Solutions

Getting prefix and postfix evaluation to agree on every expression, including nested brackets like (7-3)*9+6. Solved by evaluating both notations independently through expression trees and comparing the results with a custom IComparer, so any conversion bug shows up as a mismatch in the report.