strlang – a simple language for string manipulation
strlang is a programming language I created with the goal of making string manipulation simple and straightforward. It is an imperative language with a minimalist syntax. The language and its compiler were written as part of the Programming Languages and Translators (COMS 4115) course at Columbia University in Fall 2011.
- Basic data types are strings, numbers and maps (sets of key-value pairs)
- Full-set of operators for arithmetic, string manipulation (including basic regular expressions) and map construction
- C-like structure including functions, loops, conditionals and expressions
- No keywords
The strlang compiler performs syntax and static-semantic checking. Valid programs are compiled to a linearized form of C++ (only one block per function, all operands are stored in variables, loops and conditionals are simplified to labels and jumps). The compiler itself is written in OCaml and comes with a testsuite. It relies on the C++ STL for its underlying data-types, and the PCRE library for regular expression support.
Documentation, including a tutorial and a language reference manual, is included in the source distribution. Building strlang requires a current OCaml distribution. To use it, you will also need a working C++ compiler and STL installation as well as an installation of the PCRE library.