emustudio / edigen

Emulator Disassembler Generator
GNU General Public License v3.0
4 stars 0 forks source link

Add ambiguous path/variant detection #3

Closed sulir closed 12 years ago

sulir commented 12 years ago

Currently it is possible to write such input file that more than one variant of a rule can match. This can cause unintended behavior of the generated instruction decoder.

It would be useful to detect such cases and stop the generator, printing an error message.

sulir commented 12 years ago

To be more precise, a unit (usually a byte) will be checked instead of the whole variant.

Ambiguity means that for some rule, given a unit of input, the decoder is not able to decide which one (and only one) execution path to choose without reading more units or walking up the switch-case tree later and choosing an another path (or not at all).

sulir commented 12 years ago

There is one more meaning of ambiguity - when one pattern has more than one child variant.

sulir commented 12 years ago

The variant ambiguity was fixed in 09a5079.