[{"data":1,"prerenderedAt":299},["ShallowReactive",2],{"project-45491609":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":36,"aspects":37,"strip":41,"post_text":45,"what":46,"said":55,"maker_in_thread":138,"shape":149,"grid":153,"attempts":260,"same_week":261,"maker_shows":32,"maker_hidden":291,"reader_version":292,"card":293},"45491609","Kent Dybvig's Scheme Machine (heap-lisp)","Kent Dybvig's Scheme Machine in 400 Lines of C (Heap-Memory Model)","title","Show HN: Kent Dybvig's Scheme Machine in 400 Lines of C (Heap-Memory Model)","https:\u002F\u002Fgist.github.com\u002Fswatson555\u002F8cc36d8d022d7e5cc44a5edb2c4f7d0b","gist.github.com","swatson741",1759759589,2025,226,44,273,3837,8,"notable","languages","scheme interpreter","cli",[24,25,26,27,28],"scheme","interpreter","c","lisp","dybvig","curious",-0.067,{"positive":32,"neutral":33,"mixed":34,"critical":35},2,10,0,4,16,{"performance":38,"idea":39,"execution":40},{"positive":34,"critical":34},{"positive":32,"critical":32},{"positive":34,"critical":32},[34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,42,34,42,34,34,34,34,42,34,42,43,43,44,42,43,42,34,34,34,42,42,34,42,34,42],3,1,5,null,{"problem":45,"audience":45,"pricing":45,"motivation":45,"time_to_build":45,"stack":47,"openness":54,"stage":54,"team_size":54},[48],{"value":49,"source":50,"evidence":51},"C","inferred",[52],{"id":53},"post","unknown",{"praise":56,"objections":69,"requests":92,"questions":104,"alternatives":116},[57],{"value":58,"source":59,"evidence":60},"Delightful, clean, inspiring small interpreter","commenter",[61,65],{"id":62,"by":63,"text":64},"45497168","dented42","What an utterly delightful itty bitty scheme. \u003C3",{"id":66,"by":67,"text":68},"45494090","qhwudbebd","Reading and hacking on the Chez Scheme codebase is always a treat and rather inspiring, especially compared with more mainstream compilers and code generators. As well as Kent…",[70,85],{"value":71,"source":59,"evidence":72},"Does not run properly; undefined behavior and assertion failures reported",[73,77,81],{"id":74,"by":75,"text":76},"45500587","lynx97","No matter what I try, I always get: heap-lisp: heap-lisp.c:99: cons: Assertion `istext(textptr)' failed. I wonder if the ptr comparison in istext is actually UB?",{"id":78,"by":79,"text":80},"45500478","spyrja","I couldn't get it to do much. Also noticed a subtle bug here: ``` next = compile(read(buffer), cons(\"halt\", NULL)); ``` C doesn't guarantee the order in which arguments to a…",{"id":82,"by":83,"text":84},"45495980","djmips","Have you tested this? Does it work?",{"value":86,"source":87,"evidence":88},"Can only demonstrate semantics, cannot do arithmetic","maker",[89],{"id":90,"by":11,"text":91},"45499263","It works but it can’t do much other than demonstrate semantics. The evaluator won’t even be able to add numbers for example.",[93],{"value":94,"source":59,"evidence":95},"Bootstrap via Forth or from bare metal assembly",[96,100],{"id":97,"by":98,"text":99},"45496715","iberator","Do Forth bootstrapping now",{"id":101,"by":102,"text":103},"45491910","lambdaone","Amazing, and you could see how this could be translated into perhaps a couple of thousand lines of assembly code to boostrap Scheme almost from the bare metal, similar to the…",[105],{"value":106,"source":59,"evidence":107},"Is the top-level environment missing?",[108,112],{"id":109,"by":110,"text":111},"45499351","matheusmoreira","> note! repl implies there's a top-level but there isn't... I'm a little confused. How could it not have a top-level environment? There are environments which are extended on…",{"id":113,"by":114,"text":115},"45496803","rogerallen","Can someone give more info on the relevance of this particular code?",[117,124,131],{"value":118,"source":59,"evidence":119},"Chez Scheme",[120],{"id":121,"by":122,"text":123},"45492695","ashton314","Kent Dybvig also wrote Chez Scheme [1] which on most benchmarks is far-and-away the fastest [2] Scheme implementation. Racket recently got rewritten to be based off of Chez [3]…",{"value":125,"source":59,"evidence":126},"MIT Scheme",[127],{"id":128,"by":129,"text":130},"45492031","glouwbug","I believe MIT Scheme compiled directly to C by intermingling switch statements and gotos to emulate its call stack. Problem was, as programs grew, compile times weren't linear. I…",{"value":132,"source":59,"evidence":133},"GNU Mes \u002F Guix bootstrap",[134],{"id":135,"by":136,"text":137},"45493067","dannyobrien","This is the path that the GNU Mes and Guix folks are taking: https:\u002F\u002Fguix.gnu.org\u002Fen\u002Fblog\u002F2023\u002Fthe-full-source-bootstrap-building-from-source-all-the-way-down\u002F (sans LLMs -- I…",{"comments":35,"answered":32,"key":139},[140,143,146],{"id":141,"text":142},"45492633","A C compiler can output fairly readable code if you turn off optimizations, and it's definitely not going to take thousands of lines to do this in modern assembly. It may be only…",{"id":144,"text":145},"45492464","You'll still probably need the `strcmp` because the pointers won't be the same unless you check for them and make them the same. You may be thinking about how `eq?` (reference…",{"id":147,"text":148},"45492918","You're right `virtmach` only works on things that are output from `compile` and maintaining the invariant that virtmach lisp uses those pointers isn't difficult to do in with how…",{"commenters":150,"max_depth":35,"maker_replies":35,"first_comment_mins":151,"lifespan_hours":152},34,32,75,[154,156,157,158,161,164,167,170,172,175,178,181,184,187,190,193,195,199,202,204,207,209,212,215,217,220,221,222,226,229,233,236,239,241,244,245,247,248,250,253,254,256,257,258],[121,34,34,155,122,34],"other\u002Fneutral\u002Fnone",[66,34,34,155,67,34],[128,43,34,155,129,34],[159,43,34,155,160,34],"45492869","kkylin",[162,43,34,163,129,34],"45494757","commenter\u002Fneutral\u002Fnone",[165,43,34,155,166,34],"45492999","f1shy",[168,43,34,163,169,34],"45493198","soegaard",[171,43,34,163,166,34],"45494346",[173,43,34,155,174,34],"45504800","anthk",[176,43,34,163,177,34],"45495247","shawn_w",[179,43,34,163,180,34],"45497873","aag",[182,32,34,155,183,34],"45494367","kfarr",[185,32,34,155,186,34],"45495749","smrq",[188,32,34,155,189,34],"45505294","keith_analog",[191,32,34,155,192,34],"45530428","Vivtek",[194,32,34,155,192,34],"45530393",[196,42,42,197,198,34],"45494863","project\u002Fneutral\u002Fperformance","miga",[200,35,34,155,201,34],"45492978","saltcured",[101,44,42,203,102,34],"project\u002Fneutral\u002Fidea",[205,44,34,163,206,34],"45491996","nostrademons",[208,44,34,163,166,34],"45492980",[210,44,34,163,211,34],"45497025","kazinator",[213,44,34,163,214,34],"45492013","listeria",[216,44,34,163,102,34],"45492073",[218,44,42,197,219,34],"45492605","tgv",[141,44,34,203,11,43],[135,44,42,203,136,34],[223,44,43,224,225,34],"45493878","project\u002Fcritical\u002Fidea","anthomtb",[227,44,43,224,228,34],"45494206","CobrastanJorji",[230,44,44,231,232,34],"45501382","project\u002Fpositive\u002Fidea","tensility",[109,234,42,235,110,34],6,"project\u002Fneutral\u002Fexecution",[74,237,43,238,75,34],7,"project\u002Fcritical\u002Fexecution",[240,237,42,235,177,34],"45502440",[242,18,42,235,243,34],"45492248","fanf2",[144,18,34,163,11,43],[246,18,34,163,243,34],"45492575",[147,18,34,163,11,43],[113,249,42,203,114,34],9,[251,249,42,203,252,34],"45497153","apgwoz",[97,33,34,155,98,34],[82,255,42,235,83,34],11,[90,255,34,238,11,43],[78,255,43,238,79,34],[62,259,44,231,63,34],12,[],[262,267,272,276,281,286],{"id":263,"name":264,"points":265,"category":266},"45504973","Timelinize",630,"productivity",{"id":268,"name":269,"points":270,"category":271},"45492489","nullpt.rs",348,"security_privacy",{"id":273,"name":274,"points":275,"category":266},"45490578","Write It Down",271,{"id":277,"name":278,"points":279,"category":280},"45515978","telefonefix",222,"hardware",{"id":282,"name":283,"points":284,"category":285},"45516584","Recall",171,"ai",{"id":287,"name":288,"points":289,"category":290},"45483531","ut",170,"dev_tools",false,"v2",{"id":294,"name":5,"line":6,"ai":291,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":295,"top":18,"kw":296,"maker":11,"domain":10,"tier":19,"attempts":34,"strip":297,"url":9,"mix":298,"praise":58,"objection":71,"sub":21},45491609,-0.07,[24,25,26,27,28],"0000000000000003030000303115313000330303",[32,33,34,35],1794036683714]