<html><head></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>Am Freitag, dem 16.08.2024 um 06:37 +0100 schrieb Sean Charles (emacstheviking):</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>Yes, there is something *special* that Mercury does to your mind!<br id="lineBreakAtBeginningOfMessage"></div></blockquote><div><br></div><div>I think it's its strictness and cleanness - the logic programming paradigm, with modes and determinism categories... And the type system too...</div><div><br>Cheers,</div><div>Volker</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>On 15 Aug 2024, at 16:26, Volker Wysk <post@volker-wysk.de> wrote:</div><div><br class="Apple-interchange-newline"></div><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>Hi, Sean!</div><div><br></div><div>I see, you've adopted the philosophy "Don't give in until it's done right." </div><div><br></div><div>That's not bad, I've adopted it too, not very long ago. It was after I've learned Mercury.</div><div><br></div><div>Keep hacking, and make that transpiler of yours a success. :-)</div><div><br></div><div>Cheers,<br>Volker</div><div><br></div><div><br></div><div>Am Donnerstag, dem 15.08.2024 um 07:29 +0100 schrieb Sean Charles (emacstheviking):</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><br id="lineBreakAtBeginningOfMessage"></div><div><br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>On 15 Aug 2024, at 04:18, Volker Wysk <post@volker-wysk.de> wrote:</div><div><br class="Apple-interchange-newline"></div><div><div>Am Mittwoch, dem 14.08.2024 um 19:19 +0100 schrieb Sean Charles<br>(emacstheviking):<br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>Yes, I have resisted the urge to use it, Uncle Bens rule applies here!  :D<br></div></blockquote><br>Hmm... I couldn't find out what Uncle Ben's rule is.<br></div></div></blockquote><div><br></div><div>Ah, it's from a Spiderman movie:</div><div><span style="font-family: -webkit-standard; font-size: medium;">"</span><div style="display: block;"><div style="-webkit-user-select: all; -webkit-user-drag: element; display: inline-block;" class="apple-rich-link" draggable="true" role="link" data-url="https://en.wikipedia.org/wiki/With_great_power_comes_great_responsibility"><a style="border-radius:10px;font-family:-apple-system, Helvetica, Arial, sans-serif;display:block;-webkit-user-select:none;width:300px;user-select:none;-webkit-user-modify:read-only;user-modify:read-only;overflow:hidden;text-decoration:none;" class="lp-rich-link" rel="nofollow" href="https://en.wikipedia.org/wiki/With_great_power_comes_great_responsibility" dir="ltr" role="button" draggable="false" width="300"><table style="table-layout:fixed;border-collapse:collapse;width:300px;background-color:#E5E6E9;font-family:-apple-system, Helvetica, Arial, sans-serif;" class="lp-rich-link-emailBaseTable" cellpadding="0" cellspacing="0" border="0" width="300"><tbody><tr><td vertical-align="center" align="center"><span id="cid:C7911843-5104-430C-BD9A-42D9CBAC3B71"><DreamHaven_May_30_2020_storeboards.jpg></span></td></tr><tr><td vertical-align="center"><table bgcolor="#E5E6E9" cellpadding="0" cellspacing="0" width="300" style="font-family:-apple-system, Helvetica, Arial, sans-serif;table-layout:fixed;background-color:rgba(229, 230, 233, 1);" class="lp-rich-link-captionBar"><tbody><tr><td style="padding:8px 0px 8px 0px;" class="lp-rich-link-captionBar-textStackItem"><div style="max-width:100%;margin:0px 16px 0px 16px;overflow:hidden;" class="lp-rich-link-captionBar-textStack"><div style="word-wrap:break-word;font-weight:500;font-size:12px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-topCaption-leading"><a rel="nofollow" href="https://en.wikipedia.org/wiki/With_great_power_comes_great_responsibility" style="text-decoration: none" draggable="false"><font color="#272727">With great power comes great responsibility</font></a></div><div style="word-wrap:break-word;font-weight:400;font-size:11px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-bottomCaption-leading"><a rel="nofollow" href="https://en.wikipedia.org/wiki/With_great_power_comes_great_responsibility" style="text-decoration: none" draggable="false"><font color="#808080">en.wikipedia.org</font></a></div></div></td></tr></tbody></table></td></tr></tbody></table></a></div></div><font face="-webkit-standard" size="3">"</font></div><div><br></div><div>https://en.wikipedia.org/wiki/Uncle_Ben</div><div>Sorry!</div><br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><div><br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>I am working on a FORTH engine in Mercury right now, it's going well, it<br>will basically expose the strictness of Mercury through a stack based<br>system... currently the core words are hand assembled but they have a very<br>common pattern so far, and when the dust settles I think there MIGHT be a<br>case for term rewriting to create that data.<br></div></blockquote><br>You have a lot of projects. But what would you want to do with a Forth<br>engine? Is it just for the fun of programming? ;-)<br></div></div></blockquote><div><br></div><div>Well, a loooooooong time ago I wrote this, <a href="http://felt-lang.com/">felt-lang.com</a>, since then I have rewritten it in Haskell, SWI-Prolog and C as POCs but wasn't hasppy, then the Universe showed my Mercury. It's been a very rewarding journey since and lots of what I have learned has filtered into my daily coding, mostly improved rigour in thinking about things.</div><div><br></div><div>The concept of  a transpiler is not new, I've used HaXe in the past, but *I* have never written one, currently the Mercury version parses s-expressions into working C code, which compiles, but the more I got into the weeds, the more I realised that I wanted a faster REPL based interactive/explorative environment for the code render phase, with the view that users vould use a glue language for the AT-->Code part to do whatever they want with the parsed s-expression tree.</div><div><br></div><div>For reasons best known to me3, and to avoid triggering Greenspun's tenth law, I decided I needed a custom FORTH dialect and so now I find myself engaged in hand-to-keyboard, I already have implemented basic stack ops, basic arithmetic, and a bunch of words,</div><div><br></div><div><br></div><div><div><font face="Andale Mono">➜  mercury-merth git:(main) ✗ ./dstack</font></div><div><font face="Andale Mono"> > words</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">System words:</font></div><div><font face="Andale Mono">* + - -> . .S .SEEVM .STATUS .STRICT / /MOD : ; >IOP >IOW BYE CLEARSTACK CONSTANT CR DROP DUP ELSE EMIT ENDIF IF MOD OVER RECURSE ROT SEE SPACE SPACES SWAP THEN TYPE T{ WORDS }T </font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">User words:</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono"> > : hv "Hello Volker!" type cr ;</font></div><div><font face="Andale Mono">New word defined: hv</font></div><div><font face="Andale Mono"> > words</font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">System words:</font></div><div><font face="Andale Mono">* + - -> . .S .SEEVM .STATUS .STRICT / /MOD : ; >IOP >IOW BYE CLEARSTACK CONSTANT CR DROP DUP ELSE EMIT ENDIF IF MOD OVER RECURSE ROT SEE SPACE SPACES SWAP THEN TYPE T{ WORDS }T </font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono">User words:</font></div><div><font face="Andale Mono">HV </font></div><div><font face="Andale Mono"><br></font></div><div><font face="Andale Mono"> > hv</font></div><div><font face="Andale Mono">Hello Volker!</font></div><div><font face="Andale Mono"> > </font></div><div><br></div></div><div>I implemented the test words, T{ -> }T early on, and I copy the relevant tests from the Forth standards site and so far all passing which feels nice, for example, from <a href="https://forth-standard.org/standard/core/IF">https://forth-standard.org/standard/core/IF</a></div><div><br></div><div><div><font face="Andale Mono">"If/Else/Then" suite</font></div><div><font face="Andale Mono">T{ : GI1 IF 123 THEN ; -> }T</font></div><div><font face="Andale Mono">T{ : GI2 IF 123 ELSE 234 THEN ; -> }T</font></div><div><font face="Andale Mono">T{  0 GI1 ->     }T</font></div><div><font face="Andale Mono">T{  1 GI1 -> 123 }T</font></div><div><font face="Andale Mono">T{ -1 GI1 -> 123 }T</font></div><div><font face="Andale Mono">T{  0 GI2 -> 234 }T</font></div><div><font face="Andale Mono">T{  1 GI2 -> 123 }T</font></div><div><font face="Andale Mono">T{ -1 GI1 -> 123 }T</font></div></div><div><br></div><div><br></div><div>My dialect will expose all the Mercury basic types and modules, the stack only allows int and string at the moment but I have some planned features to allow a Lua like table structure, stack signature checking, there is NO coercion of types, as I say, under the hood I intend to 'expose' Mercurys world view into the dialect, it will be a strict strict puppy that's for sure,</div><div><br></div><div>The other feature I've designed is Forth->Mercury, by analysing the stack signatures, I plan to generate raw Mercury code so I use the engine for rapid prototyping of code, then it can be printed and incorporated into my custom IDE as I go, the IDE being written in Mercury too, still on paper that one but heavily inspired by 'that Doug Englebart demo' and the Squeak Smalltalk Morphic engine.</div><div><br></div><div>So much to do, so little time.</div><div><br></div><div>And, it's *always* for the fun of programming!</div><div><br></div><div>:D</div><div><br></div><div>Sean</div><div><br></div><div><br></div><br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><div><br>Cheers,<br>Volker<br><br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><br>Thanks again.<br>Sean<br><br><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>On 14 Aug 2024, at 19:16, Volker Wysk <post@volker-wysk.de> wrote:<br><br>Am Mittwoch, dem 14.08.2024 um 19:10 +0100 schrieb Sean<br>Charles (emacstheviking):<br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>That's the chap!<br><br>Thanks Volker, I just could see it, my brain was convinced it was in a folder!<br></div></blockquote><div><br>That thing is ridiculously small, for what it does.<br><br>Enjoy it!  :-)<br><br>Bye, <br>V.W.<br><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>On 14 Aug 2024, at 19:00, Volker Wysk <post@volker-wysk.de> wrote:<br><br>Am Mittwoch, dem 14.08.2024 um 18:29 +0100 schrieb Sean Charles<br>(emacstheviking):<br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div>Hi,<br><br>There was an example of term rewriting but I cannot seem to find it<br>anywhere!<br><br>Is there any code I can leverage to scan a .m file and produce an AST or<br>at least scan the terms... I know the rewrite example pretty has all the<br>answers I need but I just can't find it.<br></div></blockquote><div><br>I think you mean samples/expand_terms.m.<br><br>Cheers,<br>Volker<br>_______________________________________________<br>users mailing list<br>users@lists.mercurylang.org<br>https://lists.mercurylang.org/listinfo/users<br></div></blockquote><div><br></div></blockquote></blockquote><div><br></div></blockquote><br></div></div></blockquote></div><div><br></div><pre>_______________________________________________</pre><pre>users mailing list</pre><pre><a href="mailto:users@lists.mercurylang.org">users@lists.mercurylang.org</a></pre><pre><a href="https://lists.mercurylang.org/listinfo/users">https://lists.mercurylang.org/listinfo/users</a></pre></blockquote><div><br></div><div><span></span></div></div>_______________________________________________<br>users mailing list<br>users@lists.mercurylang.org<br>https://lists.mercurylang.org/listinfo/users<br></div></blockquote></div><div><br></div></blockquote><div><br></div><div><span></span></div></body></html>