Signals Blog

Smidge: A Lightweight SMILES Validator and Parser Written in JavaScript

The previous article in this series described some advantages of starting with a formal grammar when writing a SMILES parser. Before diving too far into technical details, have a look at Smidge, a new browser-based tool that validates and parses SMILES strings into an array of JSON token objects.

Smidge, a SMILES parser written in JavaScript

Given an invalid SMILES string, Smidge responds with a message indicating both the position of the error and the valid characters at that position.

If the entered string represents valid SMILES, Smidge responds with a graphical interpretation of all tokens, together with a JSON array containing these tokens.

The core Smidge parser was auto-generated from an enhanced grammar notation capable of combining syntax definitions with processing instructions. Future articles in this series will describe the creation of Smidge in detail.