[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: The desired behaviour of test* instructions
- From: Kees Jan Hermans <foxkjhermans@...>
- Date: Wed, 4 Sep 2019 13:48:03 +0200
Wrt Lua PEG, I have a question. The 2007 whitepaper says that test*
(testany, testchar, testset) instructions consume a character of input
on success, and jump to an offset on failure. Through this, the
following would hold up (example uses a testchar):
testchar 0a -> LABEL1
would be equivalent with:
With the exception that in the second pattern, there is stack
manipulation, which is inefficient and which the introduction of the
test* instructions optimizes out. That doesn't seem to be the case
anymore, because the test* instruction handling in lpvm.c do not
advance the input pointer.
- why is this?
- is this documented anywhere?
- what does a test* instruction optimize now?