aarroyoc / advent-of-code-2020

Solutions of Advent of Code 2020
The Unlicense
7 stars 0 forks source link

Tabling declaration for DCG non-terminals #3

Closed triska closed 3 years ago

triska commented 3 years ago

A small thing I noticed: To table a DCG non-terminal, use the non-terminal indicator F//N (note the //), for example:

:- table expr//1.

This is because there is no guarantee how or even whether a DCG non-terminal is compiled to a Prolog predicate.

aarroyoc commented 3 years ago

Thanks! I've always thought it always got transpiled to arguments arity + 2. I've updated the code