3 ms·
But how many lines of code does it take to implement the language that allows them to implement TCP in 160 LOC ?
by tgflynn 15y ago
But how many lines of code does it take to implement the language that allows them to implement TCP in 160 LOC ?
- mbrubeck 15y agoThat language is OMeta. There are several implementations; the latest JavaScript compiler is just a few hundred lines. http://www.tinlizzie.org/ometa/ http://www.tinlizzie.org/ometa/ The compiler is self-hosting; much of that JS code is actually compiled from OMeta source. For another example, the Common Lisp version includes fewer than 200 lines of OMeta source and fewer than 300 lines of Lisp source. OMeta was a very eye-opening language for me because of the great expressiveness it gets from its simple but novel approach. (I've written code in Haskell, Prolog, Scheme, OCaml, and plenty of other languages, but OMeta is not like any of them.) If you are interesting in programming languages and/or parsing, Warth's thesis is a great read.
- CodeMage 15y agoThanks for this! I'm still reading the dissertation and haven't gotten to the end yet, but so far it seems to me like what it would be like to "program in ANTLR", so to speak; except that OMeta looks easier to understand and use.
- jules 15y ago100 lines: "Ometa can be made in itself and optimized in about 100 lines of code" -- http://www.vpri.org/pdf/tr2010004_steps10.pdf http://www.vpri.org/pdf/tr2010004_steps10.pdf And then about 100-200 lines to compile the intermediate language to machine code according to this paper: http://www.vpri.org/pdf/tr2010003_PEG.pdf http://www.vpri.org/pdf/tr2010003_PEG.pdf
- wmf 15y agoThey tend to use layers of DSLs (sometimes four or five deep), but even when you add up the code for all the layers it's smaller than C.
- loup-vaillant 15y agoMuch smaller (at most 2000 lines of compiling tools). And of course, we don't count the number of lines in GCC for the C program.
- corysama 15y agoThe compilers, down to machine code, are included in the 20K budget. The special language -> intermediate form tool is only a few hundred lines. There are a couple of intermediate -> machine code tools, also a few hundred lines. And of course, together they are self-hosting. Check out the top paper in that list http://www.vpri.org/pdf/tr2011004_steps11.pdf http://www.vpri.org/pdf/tr2011004_steps11.pdf The pdf was produced in their publishing software, running on their OS, compiled with their compilers. And, they are still under budget.