[{"data":1,"prerenderedAt":259},["ShallowReactive",2],{"project-46392736":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":28,"sentiment":29,"stance_mix":30,"scored_comments":34,"aspects":35,"strip":40,"post_text":42,"what":43,"said":65,"maker_in_thread":128,"shape":137,"grid":142,"attempts":221,"same_week":222,"maker_shows":191,"maker_hidden":251,"reader_version":252,"card":253},"46392736","Xcc700","Self-hosting mini C compiler for ESP32 (Xtensa) in 700 lines","title","Show HN: Xcc700: Self-hosting mini C compiler for ESP32 (Xtensa) in 700 lines","https:\u002F\u002Fgithub.com\u002Fvaldanylchuk\u002Fxcc700","github.com","isitcontent",1766761621,2025,154,36,474,3837,13,"notable","languages","c compiler","cli",[21,24,25,26,27],"esp32","xtensa","self-hosting compiler","elf","loved",0.354,{"positive":31,"neutral":32,"mixed":33,"critical":33},4,3,0,7,{"execution":36,"idea":38,"design":39},{"positive":37,"critical":33},1,{"positive":32,"critical":33},{"positive":33,"critical":33},[33,33,32,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,41,41,33,33,33,33,33,33,32,33,41,41,33,33,32,33],5,"Repo: https:\u002F\u002Fgithub.com\u002Fvaldanylchuk\u002Fxcc700\n\nHi Everyone! I just wrote my first compiler!\n\n- single pass, recursive descent, direct emission\n\n- generates REL ELF binaries, runnable using ESP-IDF elf_loader\n\n- very basic features only, just enough for self-hosting\n\n- treats the Xtensa CPU as a stack machine for simplicity, no register allocation \u002F window usage\n\n- compilable on Mac, probably also Linux, can cross-compile for esp32 there\n\n- wrote for fun \u002F cyberdeck project\n\nSample output from esp32:\n\n\n```\n    xcc700.elf xcc700.c -o \u002Fd\u002Fcc.elf\n    \n    [ xcc700 ] BUILD COMPLETED > OK\n    > IN  : ",{"problem":44,"audience":50,"pricing":50,"motivation":51,"time_to_build":50,"stack":58,"openness":63,"stage":63,"team_size":64},{"value":45,"source":46,"evidence":47},"Provides a small C compiler that runs on the ESP32 itself","maker",[48],{"id":49},"post",null,{"value":52,"source":46,"evidence":53},"Written for fun and as a cyberdeck project; educational sandbox",[54,55],{"id":49},{"id":56,"by":11,"text":57},"46395402","There is the TCC. Adapting that would probably be a faster path to a full featured C compiler on esp32 than building up my xcc700. This is more of an educational sandbox project.",[59],{"value":60,"source":46,"evidence":61},"C",[62],{"id":49},"unknown","solo",{"praise":66,"objections":82,"requests":90,"questions":98,"alternatives":112},[67,75],{"value":68,"source":69,"evidence":70},"Easy to read and well written code because it supports only basic features","commenter",[71],{"id":72,"by":73,"text":74},"46396321","saidnooneever","hats off. this is really easy to read and well written and easy to comprehend code imho because it only support basic features. its a really nice example to read through thanks.…",{"value":76,"source":69,"evidence":77},"Nice to see different approaches to the same problem",[78],{"id":79,"by":80,"text":81},"46394190","boznz","Cool, always refreshing to see different approaches to the same problem, and you learn so much by doing, this is more the kind of tinkering I will be doing in retirement.",[83],{"value":84,"source":69,"evidence":85},"Rust is too complex to achieve this on a small device",[86],{"id":87,"by":88,"text":89},"46394948","ladyanita22","That's super cool! I have been wondering what could be done with ESP32 if it weren't for the lack of RAM. As a fun of Rust, one thing that saddens me is knowing these things…",[91],{"value":92,"source":69,"evidence":93},"Port to RISC-V",[94],{"id":95,"by":96,"text":97},"46395538","MobiusHorizons","Yeah, very cool. I was thinking about possibly porting it to risc-v and using it on my fpga based core. I was trying to build a monitor style shell, but C like environment would…",[99,106],{"value":100,"source":69,"evidence":101},"Can it run ELF programs from a memory card?",[102],{"id":103,"by":104,"text":105},"46395534","nunobrito","Can this run ELF programs that are placed on the memory card?",{"value":107,"source":69,"evidence":108},"What shell is used in the demo video?",[109],{"id":110,"by":96,"text":111},"46394371","Very cool! What was the shell you are running in the demo video?",[113,117],{"value":114,"source":46,"evidence":115},"TCC (Tiny C Compiler)",[116],{"id":56,"by":11,"text":57},{"value":118,"source":69,"evidence":119},"chibicc, kefir, sectorc",[120,124],{"id":121,"by":122,"text":123},"46395617","uecker","I know, and there are chibicc, kefir, etc. .. and I have my own experimental C compiler.",{"id":125,"by":126,"text":127},"46396627","fuhsnn","This one[1] is similar in style and supports a bit more C constructs. [1] https:\u002F\u002Fgithub.com\u002FLulzx\u002Fsectorc\u002Fblob\u002Fmaster\u002Fstage5\u002Fcc.c",{"comments":41,"answered":32,"key":129},[130,131,134],{"id":56,"text":57},{"id":132,"text":133},"46395358","Right, Rust is more complex, and it is the complex bits that make it Rust. There are sure some shortcuts possible for starters, for example scope-based lifetimes like in early…",{"id":135,"text":136},"46394494","Thanks! That is just my small custom experimental mini shell. This project started as a retro DOS-like cyberdeck, and first thing I tried to run there was DOS programs, which is…",{"commenters":138,"max_depth":139,"maker_replies":41,"first_comment_mins":140,"lifespan_hours":141},16,9,145,48,[143,147,151,155,157,160,162,164,165,167,169,171,173,176,178,180,182,184,186,188,190,193,195,196,197,198,201,204,206,208,209,212,213,215,217,219],[144,33,33,145,146,33],"46398494","other\u002Fneutral\u002Fnone","ValdikSS",[148,33,33,149,150,33],"46399623","commenter\u002Fneutral\u002Fnone","artemonster",[152,33,32,153,154,33],"46400940","project\u002Fneutral\u002Fexecution","no_time",[156,33,33,145,146,33],"46402542",[158,33,33,145,159,33],"46407539","actionfromafar",[161,37,33,145,122,33],"46395324",[56,37,33,163,11,37],"maker\u002Fneutral\u002Fidea",[121,37,33,149,122,33],[166,37,33,149,126,33],"46396516",[168,37,33,149,122,33],"46401314",[170,37,33,149,126,33],"46402389",[172,37,33,149,122,33],"46402604",[174,37,33,145,175,33],"46400786","pjmlp",[177,37,33,149,122,33],"46402655",[179,37,33,149,175,33],"46403084",[181,37,33,149,122,33],"46404670",[183,37,33,149,175,33],"46405232",[185,37,33,149,122,33],"46406514",[187,37,33,149,175,33],"46409145",[189,37,33,149,122,33],"46411391",[79,191,41,192,80,33],2,"project\u002Fpositive\u002Fidea",[72,32,41,194,73,33],"project\u002Fpositive\u002Fexecution",[125,32,33,145,126,33],[87,31,33,145,88,33],[132,31,33,145,11,37],[199,31,33,145,200,33],"46399151","apitman",[202,31,33,149,203,33],"46401256","jacquesm",[205,31,33,145,175,33],"46400795",[110,41,32,207,96,33],"project\u002Fneutral\u002Fdesign",[135,41,33,163,11,37],[210,41,41,192,211,33],"46394833","guestbest",[95,41,41,192,96,33],[214,41,33,153,11,37],"46395666",[216,41,33,149,96,33],"46398539",[103,218,32,153,104,33],6,[220,218,33,153,11,37],"46395582",[],[223,228,233,238,242,246],{"id":224,"name":225,"points":226,"category":227},"46435308","HackerBook",730,"data",{"id":229,"name":230,"points":231,"category":232},"46392910","Witr",526,"dev_tools",{"id":234,"name":235,"points":236,"category":237},"46417815","Z80-μLM",514,"ai",{"id":239,"name":240,"points":241,"category":232},"46400251","Ez FFmpeg",420,{"id":243,"name":244,"points":245,"category":227},"46442245","exopriors.com",397,{"id":247,"name":248,"points":249,"category":250},"46420453","balajmarius.com",284,"creative",false,"v2",{"id":254,"name":5,"line":6,"ai":251,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":255,"top":18,"kw":256,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":257,"url":9,"mix":258,"praise":68,"objection":84,"sub":21},46392736,0.35,[21,24,25,26,27],"003000000000000000005500000030550030",[31,32,33,33],1794036688176]