Good programming practices

interpreter

Simple SGML parser

October 30th, 2011

There exists many parsing libraries for XML, HTML and SGML. Sometimes it’s enough to use simple solution instead of whole library. I created 4 classes for parsing string into list of markups and plain text. The parser use regular expressions for extracting all elements. More…

Control flow with String

December 27th, 2010

Motivation

Some programs are controlled by short commands in text form. They may come from user, to be read from a file, or received from another program. This make communication with such a program easier and clearer for other programs. This is a special and simplified case of Interpreter design pattern.

Applications

  • Programs, which gets parameters from the command line.
  • Servlets, for which data are sent using GET or POST.
  • Applets on web pages where the parameters are placed in HTML.

For performance reasons, it is better when there will be interpreted many groups of parameters in a single code run. More…