Open jberthold opened 3 months ago
What if we wrote:
"A" "(" Int ")"
instead? Do we still get the issue?
@dwightguth suggests we could precompile the prelude and avoid this kind of issue - separate scanner for the standard library and user code. Bit of an architectural change to do this sensibly.
This is not unique to the standard library. It can crop up in KEVM et. al. when smart contract code uses identifiers that collide with variables (solution there is munging / renaming).
This is not unique to the standard library. It can crop up in KEVM et. al. when smart contract code uses identifiers that collide with variables (solution there is munging / renaming).
I also encountered this issue. My situation is that the target ASM uses A-E to represent registers. However, if I code like syntax Reg ::= "B", it will corrupt the standard library. Unfortunately, renaming "A" to "RegA" or something similar is not an option, as it does not conform to the syntax. I think the ultimate solution would be to implement namespaces, but a temporary workaround might be to add a prefix or postfix to the standard library variables.
What component is the issue in?
Front-End
Which command
What K Version?
v7.0.116
Operating System
Linux
K Definitions (If Possible)
Steps to Reproduce
When renaming
B
toBB
andC
toCC
, the compilation succeeds.In addition (as a separate issue maybe), after renaming and running
kompile test.k
, when I revert thetest.k
file to use the previous namesB
andC
and re-runkompile test.k
, the compilation also allegedly succeeds , unless thetest-kompiled
directory is deleted.Expected Results
Successful compilation independent of the chosen constructor names.