[{"data":1,"prerenderedAt":349},["ShallowReactive",2],{"project-11903674":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":27,"sentiment":28,"stance_mix":29,"scored_comments":33,"aspects":34,"strip":40,"post_text":42,"what":43,"said":66,"maker_in_thread":185,"shape":188,"grid":192,"attempts":312,"same_week":313,"maker_shows":244,"maker_hidden":341,"reader_version":342,"card":343},"11903674","rcc","My own C compiler (just for fun)","title","Show HN: My own C compiler (just for fun)","https:\u002F\u002Fgithub.com\u002Frcorcs\u002Frcc","github.com","rcorcs",1465925458,2016,175,50,174,2264,8,"notable","languages","c compiler","cli",[21,24,25,26],"compiler construction","self-hosting compiler","compiler learning","curious",-0.083,{"positive":30,"neutral":31,"mixed":32,"critical":30},3,9,0,15,{"execution":35,"design":37,"idea":38,"docs":39},{"positive":36,"critical":32},1,{"positive":32,"critical":36},{"positive":32,"critical":36},{"positive":32,"critical":36},[32,41,41,30,30,41,36,36,32,32,32,32,32,30,32,32,36,32,32,32,32,32,32,32,32,32,32,32,30,30,30,30,32,32,32,32,32,32,32,30],5,null,{"problem":44,"audience":42,"pricing":42,"motivation":51,"time_to_build":42,"stack":55,"openness":64,"stage":64,"team_size":65},{"value":45,"source":46,"evidence":47},"Learning how a fully working compiler for a real-life language is built.","maker",[48],{"id":49,"by":11,"text":50},"11906239","I know there are hundreds of C compilers and that I am just reinventing the wheel. But my main goal is just learning. I have already written another compiler before, but it was…",{"value":52,"source":46,"evidence":53},"Learning compilers and building toward research in automatic parallelisation and optimising compilers.",[54],{"id":49,"by":11,"text":50},[56],{"value":57,"source":58,"evidence":59},"C++","inferred",[60],{"id":61,"by":62,"text":63},"11904205","pmiller2","I will always upvote something like this, but I am wondering: why write it in C++? I didn't really read the whole thing, but I skimmed a bit, and didn't see a lot of advantage…","unknown","solo",{"praise":67,"objections":88,"requests":111,"questions":136,"alternatives":152},[68,81],{"value":69,"source":70,"evidence":71},"Fun project and good learning goal","commenter",[72,73,77],{"id":61,"by":62,"text":63},{"id":74,"by":75,"text":76},"11906980","warmwaffles","kudos to you, this is something I don't think I could ever accomplish but I know it's not easy. Keep learning and growing.",{"id":78,"by":79,"text":80},"11907199","markchristian","This is awesome. Thank you for sharing it with us. :)",{"value":82,"source":70,"evidence":83},"Code base looks clean and easy to navigate",[84],{"id":85,"by":86,"text":87},"11906626","d99kris","The code base looks nice and easy to navigate. I didn't see any license mentioned - I'd suggest stating one clearly for those considering to build something on top of it, or to…",[89,96,104],{"value":90,"source":70,"evidence":91},"Written in C++ rather than C, which prevents self-hosting",[92,93],{"id":61,"by":62,"text":63},{"id":94,"by":62,"text":95},"11906350","I would completely agree with you if this weren't a C compiler project. In this case, the advantage of having a self-hosting compiler is huge! Among other things, you can use the…",{"value":97,"source":70,"evidence":98},"No license stated, so it is not free software",[99,103],{"id":100,"by":101,"text":102},"11907203","cyphar","Can you please add a free software license to your project, as it's currently proprietary? I'd recommend GPL, but go with whatever you want. Contrary to popular opinion,…",{"id":85,"by":86,"text":87},{"value":105,"source":70,"evidence":106},"Automatic parallelisation is a poor idea",[107],{"id":108,"by":109,"text":110},"11907534","imtringued","Automatic parallelisation is a bad idea because the overhead caused by synchronisation is bigger than the gain. It's also a bad idea to take away control from the programmer.…",[112,117],{"value":113,"source":70,"evidence":114},"Add a free software license",[115,116],{"id":85,"by":86,"text":87},{"id":100,"by":101,"text":102},{"value":118,"source":70,"evidence":119},"Suggestions for test suites such as gcc testsuite, csmith, or tcc tests",[120,124,128,132],{"id":121,"by":122,"text":123},"11904563","m1n1","Where does one go for a fully representative sample of all kinds of valid C code to test a project like this? Or -- given a formal grammar, has someone produced a tool that…",{"id":125,"by":126,"text":127},"11904783","robertelder","For specific test cases, you could use gcc's test cases: https:\u002F\u002Fgithub.com\u002Fgcc-mirror\u002Fgcc\u002Ftree\u002Fmaster\u002Fgcc\u002Ftestsuite Not sure about the latter, but you could probably accomplish…",{"id":129,"by":130,"text":131},"11904802","moosingin3space","There's csmith: https:\u002F\u002Fembed.cs.utah.edu\u002Fcsmith\u002F",{"id":133,"by":134,"text":135},"11905006","zzzcpan","For gradual implementation I would start from a test suite in tcc [1]. Eventually adopting the one from gcc and csmith. [1] http:\u002F\u002Fbellard.org\u002Ftcc\u002F",[137,144],{"value":138,"source":70,"evidence":139},"Why use a generated parser instead of recursive descent or precedence climbing",[140],{"id":141,"by":142,"text":143},"11907065","userbinator","I'm curious to know your reasoning behind using a generated parser instead of writing your own. This might be the first \"just for fun\" C compiler I've seen on HN or elsewhere…",{"value":145,"source":70,"evidence":146},"Why write it in C++",[147,148],{"id":61,"by":62,"text":63},{"id":149,"by":150,"text":151},"11905262","codewritinfool","I was wondering the same thing... ?? Oh, and you get an upvote from me too.",[153,160,167,171,178],{"value":154,"source":70,"evidence":155},"LLVM Kaleidoscope tutorial",[156],{"id":157,"by":158,"text":159},"11905022","tmm","Does the LLVM introduction tutorial[0] kind of fit what you're suggesting? You learn how to implement a toy language called Kaleidoscope on top of the LLVM infrastructure with…",{"value":161,"source":70,"evidence":162},"c9x.me small C compiler",[163],{"id":164,"by":165,"text":166},"11904879","nickpsecurity","Seems like the ETH work on Oberon etc did that. The students kept learning by improving on or porting both the compilers and OS's. A2 Bluebottle is a fast, usable OS as a result.…",{"value":168,"source":70,"evidence":169},"TCC",[170],{"id":133,"by":134,"text":135},{"value":172,"source":70,"evidence":173},"CompCert",[174],{"id":175,"by":176,"text":177},"11905706","Jabbles","Actually the bugs they found in CompCert were not in the proved sections. The CSmith paper says \"As of early 2011, the under-development version of CompCert is the only compiler…",{"value":179,"source":70,"evidence":180},"Andrew Chambers' self-hosting C compiler",[181],{"id":182,"by":183,"text":184},"11905855","andrewchambers","could you add my own self hosting C compiler: https:\u002F\u002Fgithub.com\u002Fandrewchambers\u002Fc",{"comments":36,"answered":32,"key":186},[187],{"id":49,"text":50},{"commenters":189,"max_depth":41,"maker_replies":36,"first_comment_mins":190,"lifespan_hours":191},35,63,32,[193,195,197,199,201,205,209,210,212,216,218,220,224,225,228,230,233,235,237,239,243,246,250,253,255,257,260,263,265,267,270,271,274,277,280,283,286,287,288,290,291,293,294,296,298,301,304,305,307,310],[49,32,32,194,11,36],"project\u002Fneutral\u002Fidea",[85,32,41,196,86,32],"project\u002Fpositive\u002Fexecution",[74,32,41,198,75,32],"maker\u002Fpositive\u002Fnone",[141,32,30,200,142,32],"maker\u002Fneutral\u002Fdesign",[202,32,32,203,204,32],"11907463","commenter\u002Fneutral\u002Fnone","bluetomcat",[206,32,30,207,208,32],"11907166","maker\u002Fneutral\u002Fnone","vasili111",[78,32,41,198,79,32],[108,32,36,211,109,32],"project\u002Fcritical\u002Fidea",[213,32,32,214,215,32],"11907664","commenter\u002Fneutral\u002Fidea","pipeep",[61,36,36,217,62,32],"project\u002Fcritical\u002Fdesign",[149,36,32,219,150,32],"commenter\u002Fpositive\u002Fnone",[221,36,32,222,223,32],"11906200","commenter\u002Fneutral\u002Fdesign","unsignedqword",[94,36,32,222,62,32],[226,36,32,222,227,32],"11906895","mac01021",[229,36,32,214,142,32],"11908609",[231,36,32,222,232,32],"11908002","apk17",[234,36,30,194,142,32],"11907007",[236,36,32,203,232,32],"11907996",[238,36,32,214,142,32],"11908671",[240,36,32,241,242,32],"11907706","commenter\u002Fneutral\u002Fperformance","reacweb",[100,244,36,245,101,32],2,"project\u002Fcritical\u002Fdocs",[247,30,32,248,249,32],"11904709","other\u002Fneutral\u002Fnone","sheepleherd",[251,30,32,203,252,32],"11904762","marvy",[254,30,32,203,249,32],"11904796",[256,30,32,203,252,32],"11907336",[258,30,32,248,259,32],"11904801","adrianN",[261,30,32,262,249,32],"11904950","other\u002Fneutral\u002Fidea",[157,30,32,264,158,32],"other\u002Fneutral\u002Fdocs",[266,30,32,264,249,32],"11905146",[268,30,32,264,269,32],"11906206","abecedarius",[164,30,32,248,165,32],[272,30,32,248,273,32],"11905734","enqk",[275,30,32,248,276,32],"11906497","akkartik",[278,30,32,248,279,32],"11906310","skybrian",[281,30,32,248,282,32],"11906331","dragonwriter",[121,284,30,285,122,32],4,"project\u002Fneutral\u002Fdocs",[125,284,30,285,126,32],[129,284,30,285,130,32],[289,284,32,248,165,32],"11904904",[133,284,30,285,134,32],[292,284,32,248,165,32],"11905829",[175,284,32,248,176,32],[295,284,32,248,165,32],"11905814",[297,284,32,248,142,32],"11906969",[299,284,32,248,300,32],"11906461","hardmath123",[302,41,32,248,303,32],"11905550","melling",[182,41,32,248,183,32],[306,41,32,248,303,32],"11906638",[308,41,30,207,309,32],"11908105","pkd",[311,41,30,207,303,32],"11913453",[],[314,319,324,328,331,336],{"id":315,"name":316,"points":317,"category":318},"11890991","remotebase.io",747,"productivity",{"id":320,"name":321,"points":322,"category":323},"11910806","Segment AWS Stack",237,"infrastructure",{"id":325,"name":326,"points":327,"category":318},"11871527","Vector",186,{"id":329,"name":330,"points":327,"category":20},"11896598","quiet-lwip",{"id":332,"name":333,"points":334,"category":335},"11884204","Jason",165,"dev_tools",{"id":337,"name":338,"points":339,"category":340},"11909548","Deskulu",137,"web_saas",false,"v2",{"id":344,"name":5,"line":6,"ai":341,"cat":20,"year":13,"points":14,"comments":15,"rec":27,"s":345,"top":18,"kw":346,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":347,"url":9,"mix":348,"praise":69,"objection":90,"sub":21},11903674,-0.08,[21,24,25,26],"0553351100000300100000000000333300000003",[30,31,32,30],1794036545134]