Question

I have seen people save Forth source code files with the extensions .4th, .fth, .frt and .f. Which is the most common filename extension of Forth source code files?

Was it helpful?

Solution

I searched for various file extension on GitHub (plus "dup drop swap"), and this was the result:

  1. .fs 4783 hits
  2. .fth 1144
  3. .4th 509
  4. .f 398
  5. .fr 143
  6. .4 55
  7. .frt 46
  8. .scr 30
  9. .forth 20
  10. .ft 11
  11. .fb 4
  12. .blk 2
  13. .seq 1
  14. .ans 1
  15. .for 1
  16. .fo 0

If nothing else, this shows there are many file extensions to chose from.

OTHER TIPS

Gforth advocates .fs in its documentation, which is a pretty good standard for such things.

Inspired by Lars Brinkhoff's answer, I ran some queries myself on GitHub to find out how the various extension names are used between various languages (not just Forth). For each extension in the list below, only the top 3 languages with the highest number of results are shown:

The results above were obtained on 13 May 2021 at 15:30 UTC.

Note: GitHub sometimes detects the wrong language for source code files. The above queries attempt to reduce the impact of such errors on the results above but they aren't perfect.

Conclusions:

  • The most popular extension for Forth source code appears to be .fs but the extension .fs is most often used for F#. In fact there are about twice as many F# source code files with this extension as there are for Forth.
  • The most popular extension for Forth source code that does not appear to be used for any other language is .fth.
  • The extensions .4th, .frt, and .forth also do not appear to be used for any other language, however, these extensions are less popular than .fth.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top