the terminal uses a DFA to handle input. Instead of normal tokens, it will use a function callback to notify whoever of the occurence.