Fork me on GitHub

I’m running an experiment and I want to count the number of lines of code taken for a program across several languages. I also want to see if I can count the bytes of the same solution “minified”. How would I approach this? I looked at existing linters to see if I can do something like this. I tried using read but I wanted to check if there is already something I could potentially use


@srijayanth not directly related to your question, but I'm curious about your methodology. Will you include the source for the standard library (or any other libraries used) for a language?


No. I thought of it, but that’s a rabbit hole I want to avoid initially. If I get this done, I’ll certainly extend it maybe


Maybe I should just use and spit it out myself…


@ludvikgalois - I will initially stick to programs that don’t need help other than the standard library


@srijayanth If you're on macOS/Linux, why not just wc -l to get the line count?


@seancorfield - I will get the line count, but I also want to run a minifier on each of them to see what I get.


there is also which should be faster


Yes, wc counts lines, words (based on whitespace separation) and total characters.