[{"data":1,"prerenderedAt":167},["ShallowReactive",2],{"project-16719648":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":33,"aspects":34,"strip":38,"post_text":40,"what":41,"said":51,"maker_in_thread":88,"shape":93,"grid":98,"attempts":130,"same_week":131,"maker_shows":31,"maker_hidden":160,"reader_version":161,"card":162},"16719648","ShivyC","Hobby C compiler created in Python","title","Show HN: ShivyC – Hobby C compiler created in Python","https:\u002F\u002Fgithub.com\u002FShivamSarodia\u002FShivyC","github.com","ssarodia",1522442624,2018,120,11,364,2155,17,"notable","languages","compiler","cli",[24,25,26,27],"c compiler","python compiler","hobby compiler","parser","mixed",0,{"positive":31,"neutral":32,"mixed":29,"critical":32},1,2,5,{"execution":35,"performance":36,"idea":37},{"positive":29,"critical":31},{"positive":29,"critical":31},{"positive":31,"critical":29},[39,29,29,31,31,29,29,29,29,33,39],3,null,{"problem":40,"audience":40,"pricing":40,"motivation":40,"time_to_build":40,"stack":42,"openness":49,"stage":50,"team_size":50},[43],{"value":44,"source":45,"evidence":46},"Python","maker",[47],{"id":48},"post","open_source","unknown",{"praise":52,"objections":65,"requests":77,"questions":82,"alternatives":87},[53],{"value":54,"source":55,"evidence":56},"Interesting exception-oriented parser design","commenter",[57,61],{"id":58,"by":59,"text":60},"16720567","userbinator","The parser has a somewhat unusual structure: https:\u002F\u002Fgithub.com\u002FShivamSarodia\u002FShivyC\u002Fblob\u002Fmaster\u002Fshivyc\u002Fparser\u002Fstatement.py It's been a while since I've had to use the phrase…",{"id":62,"by":63,"text":64},"16723759","dangerbird2","Python implements iterators by raising a GeneratorExit, StopIteration or StopAsyncIteration exception. Exception handling is one of the core means of control flow in python along…",[66],{"value":67,"source":55,"evidence":68},"Using exceptions for parsing control flow is extreme and slow, e.g. multiple errors raised per for statement",[69,73],{"id":70,"by":71,"text":72},"16722517","lou1306","Using exceptions is totally common, but this seems to raise\u002Fcatch\u002Flog 6 errors each time it tries to parse a `for` statement. I'm a noob when it comes to compilers, but maybe a…",{"id":74,"by":75,"text":76},"16722922","JasonFruit","That does sound a bit extreme. (I freely admit I went by this description and never looked at the parser code myself, though some other portions I did read were pretty normal…",[78],{"value":79,"source":55,"evidence":80},"Suggestion to use a token-to-function dictionary for parsing",[81],{"id":70,"by":71,"text":72},[83],{"value":84,"source":55,"evidence":85},"Can C be parsed by branching on the next token without exceptions?",[86],{"id":58,"by":59,"text":60},[],{"comments":31,"answered":29,"key":89},[90],{"id":91,"text":92},"16723911","Thanks for your feedback! :) The main downside I see to branching on the next token within the parse_statement function itself is that doing so would split logic between the…",{"commenters":94,"max_depth":95,"maker_replies":31,"first_comment_mins":96,"lifespan_hours":97},10,4,97,20,[99,101,105,108,110,112,114,117,120,122,126],[58,29,39,100,59,29],"project\u002Fneutral\u002Fexecution",[102,29,29,103,104,29],"16720994","commenter\u002Fneutral\u002Fnone","app4soft",[106,29,29,107,75,29],"16721391","commenter\u002Fcritical\u002Fexecution",[70,29,31,109,71,29],"project\u002Fcritical\u002Fperformance",[74,29,31,111,75,29],"project\u002Fcritical\u002Fexecution",[62,29,29,113,63,29],"commenter\u002Fneutral\u002Fexecution",[115,29,29,113,116,29],"16722163","pebers",[118,29,29,113,119,29],"16722886","skocznymroczny",[91,29,29,121,11,31],"maker\u002Fneutral\u002Fexecution",[123,31,33,124,125,29],"16720301","project\u002Fpositive\u002Fidea","deaddodo",[127,31,39,128,129,29],"16721426","project\u002Fneutral\u002Fnone","rs86",[],[132,137,142,146,151,156],{"id":133,"name":134,"points":135,"category":136},"16754987","zero-width-chrome-extension",385,"dev_tools",{"id":138,"name":139,"points":140,"category":141},"16706666","text2mindmap",323,"productivity",{"id":143,"name":144,"points":145,"category":141},"16743030","“Who is hiring",255,{"id":147,"name":148,"points":149,"category":150},"16742492","Alpaca My Bags",238,"consumer_social",{"id":152,"name":153,"points":154,"category":155},"16721831","Auditus",146,"creative",{"id":157,"name":158,"points":159,"category":20},"16743476","Diamond",106,false,"v2",{"id":163,"name":5,"line":6,"ai":160,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":164,"maker":11,"domain":10,"tier":19,"attempts":29,"strip":165,"url":9,"mix":166,"praise":54,"objection":67,"sub":21},16719648,[24,25,26,27],"30011000053",[31,32,29,32],1793990972241]