notes

Detecting esolang polyglots

Language polyglots could be detected by scanning for the tokens in all recognized languages and counting occurrences. Esolangs often ignore any text outside their grammar, making them ideal for writing polyglots.

Multi-character tokens could be scanned by Aho–Corasick with overlapping search:

Single-character tokens could be detected by simple UTF-8 codepoint iteration and lookups: