Chemical Parser (2015)

A simple molecular formula parser inspired by a CodeWars problem.

Purpose

I still am in the process of learning about parsers. When I saw this CodeWars problem, I felt like this would be a good exercise in simple lexing and parsing.


Languages / Libraries:

  • Python

Concepts:

  • Language Parsing

The CodeWars problem

The Lexer

The Parser


Accomplishments:

  • Solves the CodeWars Problem
  • Working Lexer and simple parser

Needed Improvements:

  • Forgot about elements with 3 letters (Uut, Uup, etc)
  • Refactor out a generic lexer class