• Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language ATS
  • License
    BSD 3-Clause "New...
  • Created almost 7 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tool to count lines of source code.

polyglot

Build Status

poly is a command-line tool that determines project contents. The goal is to able to point it to any directory and get an accurate, complete, and informative summary of its contents.

Screenshot of sample output

It also has the secondary goal of advancing the state-of-the art for ATS, by writing practical, distributable software and supporting tooling.

Pitch

Reasons to use polyglot:

  • Accurate: won't confuse Coq and Verilog
  • Fast: polyglot is faster than all other tools
  • Pretty: magenta output

Reasons not to use polyglot:

  • Written in ATS
  • Best on Linux
  • No regex-based exclusions
  • Doesn't read .gitignore &c.
  • Doesn't count block comments
  • Multiline string bug.

Benchmarks

On the Rust repo:

Tool Language Time
polyglot ATS 134.6 ms
loc Rust 139.6 ms
scc Go 225.4 ms
tokei Rust 262.6 ms
gocloc Go 923.9 ms
cloc Perl 5.610 s
enry Go 6.926 s
linguist Ruby 20.16 s

For more extensive benchmarks, see my blog post with some additional data.

Heuristics

Polyglot distinguishes itself from tokei, gocloc, and loc by being able to disambiguate file names. Thus, poly will not confuse Happy for Yacc (for instance).

Installation

From a Script

The easiest way to install is to use the installation script, like so:

curl -sSl https://raw.githubusercontent.com/vmchale/polyglot/master/bash/install.sh | sh -s

You can optionally install compleat for shell completions as well.

Vim Plugin

There is a vim plugin available which can count lines of code in a project.

Documentation

You can view manpages for poly with

man poly

Building for Hacking

You can install ats-pkg with

curl -sSl https://raw.githubusercontent.com/vmchale/atspkg/master/bash/install.sh | sh -s

And then build poly with

git clone [email protected]:vmchale/polyglot.git
cd polyglot
atspkg build --pkg-args './gc.dhall'

This will put a binary at target/poly.

If you are on Mac, replace the last line with

atspkg build --pkg-args './mac.dhall'

Testing

To run the test suite

atspkg test --pkg-args './gc.dhall'

Languages

For languages already supported, see LANGUAGES.md

Contents

-------------------------------------------------------------------------------
 Language             Files       Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 ATS                     17        3794         3626           41          127
 C                        1          24           22            0            2
 C Header                 1          43           35            0            8
 Dash                     5         144          110            8           26
 Dhall                    5          93           83            0           10
 Markdown                 6         938          813            0          125
 TOML                     1           3            3            0            0
 YAML                     1          58           52            0            6
-------------------------------------------------------------------------------
 Total                   37        5097         4744           49          304
-------------------------------------------------------------------------------

More Repositories

1

tin-summer

Find build artifacts that are taking up disk space
Rust
306
star
2

project-init

Project templates in rust
Rust
129
star
3

command-line-tweeter

Tweets in from a pipe
Haskell
71
star
4

dhall-vim

Syntax highlighting for Dhall
Vim Script
67
star
5

jacinda

Functional, expression-oriented data processing language
Haskell
66
star
6

cpkg

A build tool/package manager for C, configured with Dhall
Dhall
65
star
7

recursion_schemes

Recursion schemes for Idris
Idris
60
star
8

kempe

Kempe is a compiled stack-based language
Haskell
56
star
9

github-actions-dhall

Dhall helpers for github actions
Dhall
55
star
10

madlang

Madlang is a language for generative literature
Haskell
52
star
11

atspkg

Build tool for ATS.
Haskell
41
star
12

apple

Apple array system
Haskell
37
star
13

permutations

Provides a type-safe way of working with permutations in Idris
Idris
30
star
14

dickinson

Text generation language
Haskell
28
star
15

tomlcheck

A syntax checker for TOML files
Haskell
28
star
16

vim-twitter

Tweet from inside vim!
Vim Script
27
star
17

libmeme

A library for inserting clap emoji into strings
Haskell
25
star
18

hs-ats

Home of the fast-arithmetic library for number theory in ATS and Haskell.
ATS
22
star
19

tw-rs

Command-Line Interface Tweeter, for rust
Rust
19
star
20

rure

Haskell bindings to Rust's regex library
Haskell
17
star
21

coronavirus

covid-19 data in J
J
16
star
22

EMD

Earth mover's distance on Nvidia GPUS
Haskell
14
star
23

doggo-command-line

Compliment your dog
Rust
13
star
24

just-vim

Syntax highlighting for Justfiles
Vim Script
13
star
25

phash

Perceptual hashing command-line tool
Haskell
13
star
26

linear

Linear lenses in Blodwen
Idris
13
star
27

ion-vim

Syntax highlighting for the ion shell
Vim Script
13
star
28

libarchive

Haskell bindings to libarchive
C
12
star
29

recursion-schemata

Generate fake recursion schemes
Haskell
12
star
30

pybqn

BQN↔NumPy bridge
C
12
star
31

edit-distance

Levenshtein edit distance, packaged for ATS
ATS
11
star
32

ats-format

ATS source code formatter
Haskell
11
star
33

j-hs

Call J from Haskell
Haskell
11
star
34

shake-dhall

Facilities for using Shake + dhall
Haskell
10
star
35

cpp-build

Use the C pre-processor on Rust projects
Rust
10
star
36

ghc-cross

aarch64 and armv7 cross-compilers
9
star
37

morphism-zoo

Some examples of recursion schemes, with benchmarks
Haskell
9
star
38

ipkg-vim

Syntax highlighting for Idris package files
Vim Script
9
star
39

ats-stats

Demonstration of GPU-accelerated statistical functions in ATS
ATS
9
star
40

kullback-liebler

Kullback-Liebler divergence in Futhark
Futhark
8
star
41

language-xats

Language library for manipulating ATS3 in Haskell.
Haskell
8
star
42

recursion

Recursion schemes in ATS
ATS
8
star
43

spherical

Library for spherical geometry in Haskell
Haskell
8
star
44

ats-benchmarks

Benchmarks of ATS compared to Rust and Haskell
Haskell
8
star
45

ats-concurrency

Concurrency primitives for ATS
ATS
8
star
46

hlint-lib

Library containing some standard HLint helpers
Dhall
7
star
47

pi-templates

Templates for pi
Haskell
7
star
48

perceptual-hash

Perceptual Hash in J
J
7
star
49

monads

Monads for viewtypes in ATS
ATS
7
star
50

hgis

Haskell as a GIS
Haskell
6
star
51

archive-backpack

Demonstration of backpack to enable substitution of tar/libarchive functionality
Haskell
6
star
52

pointfree

Wrapper of pointfree command-line tool for Haskell
Vim Script
6
star
53

hask-replace

Command-line tool to rename modules in Haskell projects
Rust
6
star
54

cabal-project-vim

Syntax highlighting for `cabal.project` files.
Vim Script
6
star
55

miso

Miso project template for GHCJS 8.6
Haskell
5
star
56

tokei-vim

Vim plugin for of tokei
Vim Script
5
star
57

linkedin-madlibs

Source for linkedin article generator
Haskell
5
star
58

brainheck

Brainh*ck intrepreter in haskell.
Brainfuck
5
star
59

haskell-ats

Template project for mixing Haskell and ATS
Haskell
5
star
60

ghci-syntax

Syntax highlighting for ghci configuration files
Vim Script
5
star
61

egison-vim

Vim syntax highlighting for Egison
Vim Script
4
star
62

avif

libavif bindings for Haskell
Haskell
4
star
63

img-fut

Image manipulation in Futhark
Futhark
4
star
64

QR-writer

Haskell library for writing QR codes to file
Haskell
4
star
65

crc32

CRC32 implementation in ATS
ATS
4
star
66

hackage-fetch

Fetch every single package on Hackage, using Python + shell madness
Haskell
4
star
67

markov-bot

Make a twitter bot from any corpus of text you desire
Python
4
star
68

viminit

Python script to initialize a vim project
Python
4
star
69

tibetan-utils

Utils for tibetan numerals in Haskell
Haskell
4
star
70

elliptic-fourier

Elliptic Fourier series in J
J
4
star
71

xmonad-vanessa

Xmonad configuration
Haskell
4
star
72

recursion-schemes-benchmarks

Benchmarks of Fibonacci functions built with recursion schemes vs. pattern matching.
Haskell
3
star
73

composition

Composition extras for Idris
Idris
3
star
74

ats-codecount

Code counter experiment in ATS
ATS
3
star
75

sql-qq

Syntax highlighting for quasi-quotes within Haskell.
Vim Script
3
star
76

madlang-miso

Frontend project template with madlang
Haskell
3
star
77

illiterate

Preprocessor for literate programming
Shell
3
star
78

hot-takes

Programming opinion generator
Haskell
3
star
79

either

Port of Data.Either for ATS
ATS
3
star
80

q-bench

benchmarks of q(-sql)
R
3
star
81

oeis

OEIS functions in Haskell
Haskell
3
star
82

cli-setup

Helper scripts to install manpages alongside a command-line tool.
Rust
3
star
83

dir-traverse

Recursive directory traversals in Haskell
Haskell
2
star
84

phash-fut

Perceptual hash in Futhark
Python
2
star
85

elm-composition

Port of Haskell's composition library to Elm
Elm
2
star
86

pathological-bytestrings

Facilities for testing with ByteStrings
Haskell
2
star
87

lzlib

lzlib bindings for Haskell
Haskell
2
star
88

debug-dump

Like Debug.Trace, but allows writing to files
Haskell
2
star
89

ats-wc

Demonstration of packaing for ATS + faster/safer version of coreutils
ATS
2
star
90

basic-recursion

Basic recursion schemes in Blodwen
2
star
91

comonad

Comonads for Idris
Idris
2
star
92

NonEmpty

NonEmpty type for Dhall
Dhall
2
star
93

haskal

How to write Haskal good
Haskell
2
star
94

librarian

Tools to manage a home library
Haskell
2
star
95

tibetan-typing

An Elm app that teaches typing for Tibetan and Dzongkha.
Elm
2
star
96

ats-storable

ATS storable instance
Haskell
1
star
97

ppp

Permutations in PureScript
PureScript
1
star
98

specats

Bare-bones unit testing library for ATS
ATS
1
star
99

safe-bytecount

Safe bytecount demo in ATS
ATS
1
star
100

matrix-benchmarks

Matrix benchmarks for J/Python
J
1
star