by stepvhen · 7y ago · 0 comments
With regards to how different of a problem that would be, J's syntax is context-sensitive. If you were to accurately identify trains and forks, you could not use regex, and would probably end up implementing a subset of the J parser.
For an example of a very incomplete and largely suboptimal parser that uses the above: https://github.com/Rscho314/J-compiler/blob/master/ast.ijs
The main idea is to change visual representation instead of using delimiters. Different fonts or text sizes sizes or cursive/inverse/underline are also valid ways of displaying different "colors".