ParCinJ logo

Under the Hood: How ParCinJ works

With ParCinJ parsing of a character stream is done in two steps:

  1. A chunks the characters into tokens. Thereby some characters like white spaces might be dropped. A knows its and its position (line number and column number) in the original character stream.

    The Lexer returns a . This allows to do parsing in streaming mode.

  2. A takes the tokens provided by the token iterator and proceed accordingly when the method process() is invoked.
This allows to do the actual parsing on the level of tokens without look ahead. The current token (as provided by the TokeIterator) is enough to decide at a branch in an EBNF graph in which direction to go. A necessity is that the only one of the symbols following matches the current token. But ParCinJ does check this. It just takes the first matching symbol.