general purpose parsing implemented in javascript