Comment

Comment by chubot

Hm I looked around the repo, and there doesn't seem to be much there.

    $ find . -name '*.v'|xargs wc -l|sort -n
    ...
      314 ./glm/glm.v
      330 ./time/time.v
      338 ./builtin/utf8.v
      339 ./examples/tetris/tetris.v
      490 ./os/os.v
      630 ./compiler/scanner.v
      644 ./compiler/table.v
      712 ./gg/gg.v
      814 ./builtin/string.v
      845 ./compiler/main.v
      848 ./compiler/fn.v
     3216 ./compiler/parser.v
    12573 total

I'm a big fan of compact code, i.e. doing more with less... but I have been working on langauges for long enough to know that it takes surprisingly large amounts of code to do anything useful in this space.

If you discount the lexer and parser, it's like 8-9K lines of code, and it's hard to imagine much being done there. You can make a "toy" in that much code, but the gap to a production compiler is very wide (e.g. a minimum of 50K or 100K lines of code).

There is also this translation which is not in the repo:

    $ wc -l v.c
    15099 v.c
----

Also, this bootstrapping part looks pretty slick, except I get a core dump (on Ubuntu 16.04 with default GCC):

    $ time cc -w -o vc v.c  

    real    0m0.553s
    user    0m0.517s
    sys     0m0.035s

    ~/git/languages/v/compiler$ time ./vc -o v .
    Segmentation fault (core dumped)

    real    0m0.095s
    user    0m0.002s
    sys     0m0.000s
parent chubot 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton