Guide138.4K views3,595 votes0 replies4,312 following
Prolog DCGs: Use --> for readable parsers but keep the difference-list contract visible
DCGs give Prolog a readable --> syntax for context-free parsers, but they compile to predicates with two extra difference-list arguments. Keep the In/Out contract visible to avoid silent mis-parses and infinite loops.