You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harro! (<.< >.>) I love the concept of this language, I had to take a peek when I stumbled on its esolangs wiki page. :D Looking at the README, I was struck by the similarity to Forth. That's a good thing in my books. I mean, why boast about mere Turing completeness when Forth was once a popular choice for operating systems! :D More seriously, writing transpilers between Forth and owoScript looks like a fairly simple task, many words have identical equivalents in standard Forth. I think the only tricky words to implement in Forth would be fetchpush and pushdupe, but if the targetted Forth lets you see the stack base address, (usually S0 or sp0, but not standard,) they wouldn't be hard. (fetchdupe has an identical equivalent in pick.) Oh and there's not usually an equivalent for exp, but there are binary shifts. If performance matters at all, you might like to know that many modern Forths compile to native code, unlike Python. Gforth is one of these, and TIO supports it.
But all of this is rather subversive because you wanted to learn about writing a formal grammar. Forth needs no grammar. :D Whitespace-delimited words are read by word or parse, the compiler looks them up with words available to the programmer, and depending on whether the word should be compiled or run, it either compiles it into the current definition or runs it at compile time. The latter feature is very powerful: conditionals and loops are commonly implemented in Forth itself! So are comments, where a typical definition might be : ( [char] ) parse 2drop ;. I also like Forth because its simple syntax better supports domain-specific languages. But... I guess I shouldn't try too hard to seduce you away from fancy parsers and stuff. I have a bad habit of doing that to people. >:D I may well have a go at a Forth transpiler myself.
The text was updated successfully, but these errors were encountered:
Harro! (<.< >.>) I love the concept of this language, I had to take a peek when I stumbled on its esolangs wiki page. :D Looking at the README, I was struck by the similarity to Forth. That's a good thing in my books. I mean, why boast about mere Turing completeness when Forth was once a popular choice for operating systems! :D More seriously, writing transpilers between Forth and owoScript looks like a fairly simple task, many words have identical equivalents in standard Forth. I think the only tricky words to implement in Forth would be
fetch
push
andpushdupe
, but if the targetted Forth lets you see the stack base address, (usuallyS0
orsp0
, but not standard,) they wouldn't be hard. (fetchdupe
has an identical equivalent inpick
.) Oh and there's not usually an equivalent forexp
, but there are binary shifts. If performance matters at all, you might like to know that many modern Forths compile to native code, unlike Python. Gforth is one of these, and TIO supports it.But all of this is rather subversive because you wanted to learn about writing a formal grammar. Forth needs no grammar. :D Whitespace-delimited words are read by
word
orparse
, the compiler looks them up with words available to the programmer, and depending on whether the word should be compiled or run, it either compiles it into the current definition or runs it at compile time. The latter feature is very powerful: conditionals and loops are commonly implemented in Forth itself! So are comments, where a typical definition might be: ( [char] ) parse 2drop ;
. I also like Forth because its simple syntax better supports domain-specific languages. But... I guess I shouldn't try too hard to seduce you away from fancy parsers and stuff. I have a bad habit of doing that to people. >:D I may well have a go at a Forth transpiler myself.The text was updated successfully, but these errors were encountered: