Re:Pascal in Forth (1983)
by throwaway17_17 on Sunday December 31, 2023 @03:41AM
(#38822664)
I enjoyed reading the transcription, it is always nice to know I’m not just being a crazy lone implementer of unconventional programming language constructs.
This reminds me of what the language I use for work does, in some respects. The primary difference between the article’s subject and mine is that (using the article’s case) the ‘Forth’ is a strongly, statically typed language and the ‘macros’ representing the ‘Pascal’ syntax are typed constructs in the language. This enables both better compiler messages (error, expansion-relative info, etc) and ensures the surface ‘syntax’ is type correct before going through what could be complex expansion/alterations via the macro.
The place I use it most often as a macro-implemented-syntax is in Type expressions in definitions (with long or complicated math formulas coming in second), for a simple example:
This reminds me of what the language I use for work does, in some respects. The primary difference between the article’s subject and mine is that (using the article’s case) the ‘Forth’ is a strongly, statically typed language and the ‘macros’ representing the ‘Pascal’ syntax are typed constructs in the language. This enables both better compiler messages (error, expansion-relative info, etc) and ensures the surface ‘syntax’ is type correct before going through what could be complex expansion/alterations via the macro.
The place I use it most often as a macro-implemented-syntax is in Type expressions in definitions (with long or complicated math formulas coming in second), for a simple example:
Macro — (type of str_longer_than) -:[ Str_nt -> u32 -> Bool ]:-
Actual Syntax — {() || Str_nt || ({() || u32 || Bool} Pi)} Pi
It is just a convenience feature for me, because the macros are just a derivative feature of the language being multi-staged via modalities.