Dear all, I am trying to implement a state machine in J. I shall be happy if I can manage to take milage out of the J primitive ;: rather than use explicit coding.
The input consists of a sequence of alphanumeric characters. However, certain pairs and triples are considered as single entities, eg in "chhoyache" the input lexemes are chh, o, y, a, ch and e. Notice that ch and chh are different. The state machine itself has just 7 states. The basic aim is to emit a sequence of unicode characters as output. There are a number of ouput actions, that are of two types: buffering some potential output, and emtting some unicode sequence (depending possibly on any buffered output from the last action). I wonder if the J primitive ;: can handle this. Currently I am doing this in Java where the lexemes are created by a lexical analyzer, and the state machine is implemented in a loopy switch-case. I am looking for J-ish way of handling this. My stumbling points are the multi-character lexemes, and the output buffering. Any idea? Thanks a ton. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm