tag:blogger.com,1999:blog-7094652.post2287428098414407212..comments2024-03-23T14:36:09.980+00:00Comments on Neil Mitchell's Blog (Haskell etc): Writing a fast interpreterNeil Mitchellhttp://www.blogger.com/profile/13084722756124486154noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-7094652.post-28063549582807162662020-08-12T11:23:01.912+01:002020-08-12T11:23:01.912+01:00Timothy: I'd be keen to see what this looks li...Timothy: I'd be keen to see what this looks like in C - some of the advantage is definitely because Rust has nice typed concise closures.Neil Mitchellhttps://www.blogger.com/profile/13084722756124486154noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-60265902040838284222020-08-07T08:42:46.313+01:002020-08-07T08:42:46.313+01:00This is a fascinating approach to interpreting a l...This is a fascinating approach to interpreting a language. I've been planning on making a Parsing Expression Grammar bytecode VM for a while now and somewhat dreading the compilation process. This technique of translating an AST into a structure of closures, however, is very conceptually appealing.<br /><br />Implementing it in C will be a bit trickier, but I hear that with the proper incantations GCC should optimize function pointer tail calls, and what is a closure but a function pointer with a first argument of a pointer to a struct? The ability to contextually "compile" to different outputs is also really useful in that scenario, as it allows for handling some of the weirder situations gracefully (such as lookbehind concatenating backwards).Timothy H.https://www.blogger.com/profile/07333846154491240825noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-85153670305733085472020-04-29T18:52:34.589+01:002020-04-29T18:52:34.589+01:00Thanks Macker - I didn't realise debug rust ad...Thanks Macker - I didn't realise debug rust added that check. Using a special form of add with defined semantics should solve it. Or just use release - which makes sense for benchmarking anyway.Neil Mitchellhttps://www.blogger.com/profile/13084722756124486154noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-56499087674817137642020-04-29T09:51:14.979+01:002020-04-29T09:51:14.979+01:00debug panics with an "attempt to add with ove...debug panics with an "attempt to add with overflow".<br /><br />Using:<br /><br />cargo +nightly run --release<br /><br />"fixes" the overflowMackerhttps://www.blogger.com/profile/11932263777070266219noreply@blogger.comtag:blogger.com,1999:blog-7094652.post-61017256982754715082020-04-29T08:57:04.277+01:002020-04-29T08:57:04.277+01:00Curious to see this experiment repeated in Haskell...Curious to see this experiment repeated in Haskell...Anonymousnoreply@blogger.com