diprism / perpl

The PERPL Compiler
MIT License
10 stars 5 forks source link

Autogenerated names don't avoid collisions #74

Closed davidweichiang closed 1 year ago

davidweichiang commented 1 year ago

The solution to this would seem to depend on how serious we are about the compiler being able to process its own -c output. If yes, then names need to be chosen so as not to collide, and data structures will need to be created to remember what names were chosen.

If no, then we just need to choose a special prefix for generated names and change the lexer not to allow that prefix in user code.

davidweichiang commented 1 year ago

I lean towards using #103 to make special names that are guaranteed not to collide. These special names should show up with a special character that makes them unparsable. If we ever do want to add tests to the test script that make the compiler parse its own output, we can use a sed script to remove the special characters, but not worry about collisions.