← Back to Portfolio

Stoichiometry

Stoichiometry
csharpFeb 2026Solo Developer

Project Overview

A .NET 9.0 class library and console application designed to parse complex chemical formulas (like CuSO4 or Fe2(SO4)3), balance chemical equations, and compute molecular mass. Leverages parser tokenizers and dictionary trees.

Key Features

  • Chemical formula tokenizer parsing element quantities, sub-brackets, and hydrate dots
  • Balances unbalanced chemical equations using matrix reduction algebra
  • Retrieves element weights dynamically using a built-in periodic table system
  • Exposes fully reusable class library APIs for integration into other applications

Technical Challenges & Solutions

Correctly parsing nested brackets (e.g. Fe(NO3)3) and hydrates in chemical equations. Solved by implementing a stack-based token parser that recursively expands formula nodes and accumulates element atomic counts.