Linter for R6RS/R7RS small program semantics #202

Open
opened 2024-09-07 16:25:53 +00:00 by dpk · 1 comment
Owner

While explaining the problem with R6RS/R7RS small top-level program semantics to my fiancé he suggested that it would be possible to suggest to implementations to support a linter mode where they warn about programs which use semantics which are incompatible between the two versions. This would let people check that their programs will work both as R6-style programs (probably to be called ‘top level programs’ in R7 large) and as R7-style programs (probably to be called ‘interactive mode scripts’ in R7 large).

This is a nice idea because, while such a checker would have to be integrated with an implementation’s macro expander and thus be non-portable, when used for its intended purpose (to check portable programs) it can check a program from the implementation it’s written for, and the programmer can then know the program will have consistent semantics on all implementations (provided the program uses no other undefined, unspecified, or implementation-defined behaviour).

While explaining the problem with R6RS/R7RS small top-level program semantics to my fiancé he suggested that it would be possible to suggest to implementations to support a linter mode where they warn about programs which use semantics which are incompatible between the two versions. This would let people check that their programs will work both as R6-style programs (probably to be called ‘top level programs’ in R7 large) and as R7-style programs (probably to be called ‘interactive mode scripts’ in R7 large). This is a nice idea because, while such a checker would have to be integrated with an implementation’s macro expander and thus be non-portable, when used for its intended purpose (to check portable programs) it can check a program from the implementation it’s written for, and the programmer can then know the program will have consistent semantics on all implementations (provided the program uses no other undefined, unspecified, or implementation-defined behaviour).
dpk added this to the Bibliothecarial Fascicle milestone 2024-09-07 16:25:53 +00:00
dpk added the
Foundations
label 2024-09-07 16:25:53 +00:00
Author
Owner

Such a linter can check:

  • that there are no uses of syntax before definition (as required by R7RS small)
  • that no names are defined more than once (as required by R6RS)
  • that there is only one import declaration at the top of the program (as required by R6RS)
  • and if actual R6RS compatibility is desired, that only libraries that exist in both .sld define-library and .sls library form are used, and that only lexical syntax compatible with both languages is used (ignoring the strict requirement to use #!r6rs, which R7-small implementations will reject)
Such a linter can check: - that there are no uses of syntax before definition (as required by R7RS small) - that no names are defined more than once (as required by R6RS) - that there is only one import declaration at the top of the program (as required by R6RS) - and if actual R6RS compatibility is desired, that only libraries that exist in both .sld `define-library` and .sls `library` form are used, and that only lexical syntax compatible with both languages is used (ignoring the strict requirement to use `#!r6rs`, which R7-small implementations will reject)
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: scheme/r7rs#202
No description provided.