Overview of Oils Code

category total lines num files
OSH (and common libraries) 40,976 81
YSH 8,414 24
Data Languages 1,832 10
Tools 1,308 5
YSH stdlib 474 8
Code Borrowed from Python's stdlib 429 5
Spec Tests 46,316 171
Gold Tests 2,775 27
Python Unit Tests 10,478 69
Other Shell Tests 16,730 63
Test Automation 1,308 10
mycpp Translator 5,383 12
mycpp Test Data 3,943 45
Zephyr ASDL 3,267 11
pgen2 Parser Generator 1,847 8
Other Code Generators 2,995 11
Yaks 488 4
Hand-written C++ Code 3,345 29
Garbage-Collected Runtime 4,879 22
Unit tests in C++ 7,575 26
Incremental C++ Build 3,389 19
Build Automation 7,577 37
Release Automation 2,453 7
Soil: Multi-cloud CI with containers 3,687 22
Benchmarks 8,612 46
Metrics 1,631 8
Generated Python Code 26,903 24
Doc Tools 4,447 14
Web 1,086 5

Related Documents

The README for oilshell/oil has another overview of the repository.

OSH (and common libraries)

This is the input to the translators, written in statically-typed Python. Note that bash is at least 140K lines of code, and OSH implements a large part of bash and more.

bin/oils_for_unix.py                            198
builtin/assign_osh.py                           564
builtin/bracket_osh.py                          285
builtin/completion_osh.py                       508
builtin/dirs_osh.py                             336
builtin/io_osh.py                               188
builtin/meta_osh.py                             467
builtin/misc_osh.py                             115
builtin/printf_osh.py                           508
builtin/process_osh.py                          381
builtin/pure_osh.py                             483
builtin/readline_osh.py                         142
builtin/read_osh.py                             513
builtin/trap_osh.py                             274
core/alloc.py                                   301
core/ansi.py                                     15
core/completion.py                            1,502
core/comp_ui.py                                 584
core/dev.py                                     639
core/error.py                                   342
core/executor.py                                685
core/main_loop.py                               395
core/num.py                                      99
core/optview.py                                  58
core/process.py                               1,932
core/pyos.py                                    402
core/pyutil.py                                  214
core/runtime.asdl                               170
core/shell.py                                 1,108
core/state.py                                 2,359
core/ui.py                                      462
core/util.py                                    161
core/value.asdl                                 169
core/vm.py                                      336
frontend/args.py                                659
frontend/builtin_def.py                         162
frontend/consts.py                              340
frontend/flag_def.py                            525
frontend/flag_spec.py                           349
frontend/flag_util.py                            69
frontend/id_kind_def.py                         794
frontend/lexer_def.py                         1,056
frontend/lexer.py                               457
frontend/location.py                            572
frontend/match.py                               284
frontend/option_def.py                          398
frontend/parse_lib.py                           405
frontend/py_readline.py                         104
frontend/reader.py                              256
frontend/signal_def.py                           94
frontend/syntax_abbrev.py                       137
frontend/syntax.asdl                            633
frontend/typed_args.py                          533
frontend/types.asdl                              56
osh/arith_parse.py                              194
osh/bool_parse.py                               280
osh/bool_stat.py                                135
osh/braces.py                                   539
osh/cmd_eval.py                               2,146
osh/cmd_parse.py                              2,706
osh/glob_.py                                    494
osh/history.py                                  193
osh/prompt.py                                   373
osh/sh_expr_eval.py                           1,106
osh/split.py                                    307
osh/string_ops.py                               601
osh/tdop.py                                     340
osh/word_compile.py                             280
osh/word_eval.py                              2,348
osh/word_parse.py                             2,108
osh/word_.py                                    796
pyext/fanos.c                                   119
pyext/fastfunc.c                                107
pyext/fastfunc.pyi                                8
pyext/fastlex.c                                 324
pyext/fastlex.pyi                                18
pyext/libc.c                                    416
pyext/libc.pyi                                   18
pyext/line_input.pyi                             32
pyext/posix_.pyi                                210

40,976 lines in 81 files  

YSH

Expression grammar, parser, evaluator, etc.

builtin/completion_ysh.py                        69
builtin/error_ysh.py                            174
builtin/func_eggex.py                           186
builtin/func_hay.py                             150
builtin/func_misc.py                            459
builtin/hay_ysh.py                              431
builtin/io_ysh.py                               244
builtin/json_ysh.py                             143
builtin/meta_ysh.py                             101
builtin/method_dict.py                           45
builtin/method_io.py                             43
builtin/method_list.py                          100
builtin/method_other.py                          32
builtin/method_str.py                           498
builtin/module_ysh.py                           120
builtin/pure_ysh.py                             270
ysh/expr_eval.py                              1,391
ysh/expr_parse.py                               373
ysh/expr_to_ast.py                            1,633
ysh/func_proc.py                                546
ysh/grammar.pgen2                               515
ysh/regex_translate.py                          397
ysh/val_ops.py                                  494

8,414 lines in 24 files  

Data Languages

JSON, J8 Notation, ...

data_lang/nil8.asdl                              33
data_lang/pretty.asdl                            19
data_lang/j8_lite.py                             46
data_lang/j8.py                               1,053
data_lang/pretty.py                              40
data_lang/pyj8.py                                27
data_lang/j8.h                                  365
data_lang/j8_libc.c                             221
data_lang/j8_libc.h                              28

1,832 lines in 10 files  

Tools

tools/deps.py                                   149
tools/fmt.py                                     25
tools/readlink.py                                31
tools/ysh_ify.py                              1,103

1,308 lines in 5 files  

YSH stdlib

stdlib/args.ysh                                 211
stdlib/funcs.ysh                                  5
stdlib/list.ysh                                  37
stdlib/math.ysh                                  79
stdlib/methods.ysh                               18
stdlib/prelude.ysh                               25
stdlib/testing.ysh                               99

474 lines in 8 files  

Code Borrowed from Python's stdlib

pylib/cgi.py                                     19
pylib/collections_.py                           214
pylib/os_path.py                                169
pylib/path_stat.py                               27

429 lines in 5 files  

Spec Tests

A comprehensive test suite that compares OSH against other shells. If OSH passes these tests in BOTH Python and C++, it means that the translation works.

spec/alias.test.sh                              552
spec/append.test.sh                             302
spec/arith-context.test.sh                       81
spec/arith.test.sh                              761
spec/array-compat.test.sh                       189
spec/array.test.sh                              627
spec/assign-deferred.test.sh                    105
spec/assign-dialects.test.sh                     61
spec/assign-extended.test.sh                    855
spec/assign.test.sh                             674
spec/assoc.test.sh                              645
spec/assoc-zsh.test.sh                           53
spec/background.test.sh                         184
spec/ble-features.test.sh                       644
spec/ble-idioms.test.sh                         157
spec/blog1.test.sh                               95
spec/blog2.test.sh                               49
spec/blog-other1.test.sh                         57
spec/brace-expansion.test.sh                    502
spec/bugs.test.sh                               342
spec/builtin-bash.test.sh                       192
spec/builtin-bracket.test.sh                    641
spec/builtin-completion.test.sh                 485
spec/builtin-dirs.test.sh                       238
spec/builtin-eval-source.test.sh                249
spec/builtin-getopts.test.sh                    347
spec/builtin-history.test.sh                    196
spec/builtin-io.test.sh                         859
spec/builtin-printf.test.sh                     901
spec/builtins2.test.sh                          444
spec/builtin-special.test.sh                    111
spec/builtins.test.sh                           436
spec/builtin-times.test.sh                       15
spec/builtin-trap-bash.test.sh                  557
spec/builtin-trap.test.sh                       337
spec/builtin-type-bash.test.sh                  326
spec/builtin-type.test.sh                       117
spec/builtin-vars.test.sh                       701
spec/case_.test.sh                              178
spec/command-parsing.test.sh                     63
spec/command-sub.test.sh                        285
spec/command_.test.sh                           194
spec/comments.test.sh                            11
spec/dbracket.test.sh                           586
spec/dparen.test.sh                             204
spec/empty-bodies.test.sh                        24
spec/errexit-osh.test.sh                        758
spec/errexit.test.sh                            393
spec/exit-status.test.sh                        280
spec/explore-parsing.test.sh                     42
spec/extglob-files.test.sh                      377
spec/extglob-match.test.sh                      400
spec/fatal-errors.test.sh                       186
spec/for-expr.test.sh                           117
spec/func-parsing.test.sh                       105
spec/globignore.test.sh                         159
spec/glob.test.sh                               375
spec/hay-isolation.test.sh                      169
spec/hay-meta.test.sh                           200
spec/hay.test.sh                                699
spec/here-doc.test.sh                           370
spec/if_.test.sh                                 56
spec/interactive-parse.test.sh                   37
spec/interactive.test.sh                        343
spec/introspect.test.sh                         295
spec/let.test.sh                                 23
spec/loop.test.sh                               473
spec/nameref.test.sh                            638
spec/nix-idioms.test.sh                         153
spec/nocasematch-match.test.sh                   71
spec/nul-bytes.test.sh                          158
spec/parse-errors.test.sh                       192
spec/pipeline.test.sh                           197
spec/posix.test.sh                              153
spec/process-sub.test.sh                        201
spec/prompt.test.sh                             255
spec/quote.test.sh                              230
spec/redirect-multi.test.sh                     308
spec/redirect.test.sh                           677
spec/regex.test.sh                              356
spec/serialize.test.sh                          236
spec/shell-grammar.test.sh                      206
spec/sh-func.test.sh                            150
spec/sh-options.test.sh                         697
spec/sh-usage.test.sh                            94
spec/smoke.test.sh                              126
spec/strict-options.test.sh                     249
spec/subshell.test.sh                            23
spec/tilde.test.sh                              172
spec/TODO-deprecate.test.sh                      43
spec/toysh-posix.test.sh                        347
spec/toysh.test.sh                              144
spec/type-compat.test.sh                        105
spec/var-num.test.sh                             43
spec/var-op-bash.test.sh                        310
spec/var-op-len.test.sh                         219
spec/var-op-patsub.test.sh                      399
spec/var-op-slice.test.sh                       315
spec/var-op-strip.test.sh                       357
spec/var-op-test.test.sh                        339
spec/var-ref.test.sh                            509
spec/vars-bash.test.sh                           30
spec/vars-special.test.sh                       625
spec/var-sub-quote.test.sh                      312
spec/var-sub.test.sh                             60
spec/word-eval.test.sh                           62
spec/word-split.test.sh                         421
spec/xtrace.test.sh                             358
spec/ysh-assign.test.sh                         399
spec/ysh-augmented.test.sh                      217
spec/ysh-bin.test.sh                             19
spec/ysh-blocks.test.sh                         367
spec/ysh-bugs.test.sh                            94
spec/ysh-builtin-ctx.test.sh                    159
spec/ysh-builtin-error.test.sh                  180
spec/ysh-builtin-eval.test.sh                    98
spec/ysh-builtin-help.test.sh                    50
spec/ysh-builtin-meta.test.sh                   129
spec/ysh-builtin-module.test.sh                  88
spec/ysh-builtin-process.test.sh                 85
spec/ysh-builtin-shopt.test.sh                  180
spec/ysh-builtins.test.sh                       489
spec/ysh-case.test.sh                           245
spec/ysh-command-sub.test.sh                    126
spec/ysh-completion.test.sh                     204
spec/ysh-convert.test.sh                        171
spec/ysh-demo.test.sh                            59
spec/ysh-dev.test.sh                            120
spec/ysh-dict.test.sh                            91
spec/ysh-expr-arith.test.sh                     369
spec/ysh-expr-bool.test.sh                      181
spec/ysh-expr-compare.test.sh                   382
spec/ysh-expr-sub.test.sh                        42
spec/ysh-expr.test.sh                           696
spec/ysh-for.test.sh                            153
spec/ysh-func-builtin.test.sh                    24
spec/ysh-funcs-external.test.sh                  86
spec/ysh-func.test.sh                           536
spec/ysh-interactive.test.sh                     37
spec/ysh-int-float.test.sh                      116
spec/ysh-json.test.sh                         1,000
spec/ysh-keywords.test.sh                        37
spec/ysh-list.test.sh                            97
spec/ysh-methods.test.sh                        437
spec/ysh-multiline.test.sh                      193
spec/ysh-options-assign.test.sh                 106
spec/ysh-options.test.sh                        816
spec/ysh-place.test.sh                          136
spec/ysh-proc.test.sh                           293
spec/ysh-prompt.test.sh                         133
spec/ysh-regex-api.test.sh                      830
spec/ysh-regex.test.sh                          711
spec/ysh-reserved.test.sh                        48
spec/ysh-scope.test.sh                          691
spec/ysh-slice-range.test.sh                    209
spec/ysh-source.test.sh                          29
spec/ysh-special-vars.test.sh                    50
spec/ysh-stdlib-2.test.sh                       136
spec/ysh-stdlib-args.test.sh                    333
spec/ysh-stdlib-testing.test.sh                  45
spec/ysh-stdlib.test.sh                         160
spec/ysh-string.test.sh                         429
spec/ysh-tuple.test.sh                           28
spec/ysh-unicode.test.sh                         20
spec/ysh-usage.test.sh                           48
spec/ysh-user-feedback.test.sh                  141
spec/ysh-var-sub.test.sh                         45
spec/ysh-with-sh.test.sh                        221
spec/ysh-word-eval.test.sh                      145
spec/ysh-xtrace.test.sh                         528

46,316 lines in 171 files  

Gold Tests

Another suite that tests shells "from the outside". Instead of making explicit assertions, we verify that OSH behaves like bash.

test/gold/abuild.sh                               9
test/gold/and-or.sh                              27
test/gold/autoconf-backtick.sh                   50
test/gold/big-here-doc.sh                     1,531
test/gold/case-in-subshell.sh                    37
test/gold/char-class.sh                          33
test/gold/command-sub-2.sh                       12
test/gold/command-sub.sh                         39
test/gold/comments.sh                            22
test/gold/complex-here-docs.sh                  192
test/gold/configure-bug.sh                       13
test/gold/de1.sh                                 24
test/gold/declare.sh                             28
test/gold/dollar-sq.sh                           42
test/gold/echo-e.sh                              36
test/gold/errexit-confusion.sh                  139
test/gold/errexit.sh                            121
test/gold/export.sh                              65
test/gold/glob.sh                                26
test/gold/lineno.sh                              23
test/gold/nix.sh                                 32
test/gold/readlink.sh                            61
test/gold/readonly.sh                            24
test/gold/scope.sh                              126
test/gold/strip-op-char-class.sh                  6
test/gold/word-eval.sh                           57

2,775 lines in 27 files  

Python Unit Tests

asdl/format_test.py                              46
asdl/front_end_test.py                          181
asdl/gen_python_test.py                         180
asdl/examples/typed_arith_parse_test.py         227
build/dynamic_deps_test.py                       27
build/ninja_lib_test.py                         253
builtin/bracket_osh_test.py                      26
builtin/completion_osh_test.py                   16
builtin/func_misc_test.py                        27
builtin/misc_osh_test.py                         28
builtin/readline_osh_test.py                    100
builtin/read_osh_test.py                         35
core/alloc_test.py                               53
core/completion_test.py                         823
core/comp_ui_test.py                            177
core/process_test.py                            259
core/pyutil_test.py                              17
core/state_test.py                              343
core/ui_test.py                                  33
core/util_test.py                                58
data_lang/j8_test.py                            229
data_lang/pretty_test.py                         18
data_lang/pyj8_test.py                           52
doctools/cmark_test.py                          192
doctools/help_gen_test.py                        53
doctools/html_lib_test.py                        34
doctools/oils_doc_test.py                        70
doctools/spelling_test.py                        50
doctools/split_doc_test.py                      102
frontend/args_test.py                           237
frontend/id_kind_def_test.py                     97
frontend/lexer_def_test.py                      454
frontend/lexer_gen_test.py                       53
frontend/lexer_test.py                          172
frontend/match_test.py                          113
frontend/reader_test.py                          74
frontend/typed_args_test.py                     158
lazylex/html_test.py                             90
ysh/expr_parse_test.py                          163
ysh/regex_translate_test.py                      52
ysh/val_ops_test.py                              44
osh/arith_parse_test.py                         183
osh/bool_parse_test.py                          122
osh/braces_test.py                              186
osh/cmd_eval_test.py                             81
osh/cmd_parse_test.py                         1,493
osh/glob_test.py                                160
osh/history_test.py                             126
osh/prompt_test.py                               60
osh/split_test.py                               164
osh/string_ops_test.py                          190
osh/word_compile_test.py                         16
osh/word_eval_test.py                           132
osh/word_parse_test.py                          622
osh/word_test.py                                176
pyext/fanos_test.py                             274
pyext/fastfunc_test.py                           55
pyext/fastlex_test.py                            83
pyext/libc_test.py                              310
pyext/line_input_test.py                         27
pyext/posix_test.py                             184
pylib/os_path_test.py                            59
pylib/path_stat_test.py                          24
soil/web_test.py                                 53
test/sh_spec_test.py                            157
test/wild_report_test.py                         29
tools/fmt_test.py                                18
tools/ysh_ify_test.py                            78

10,478 lines in 69 files  

Other Shell Tests

test/all.sh                                      92
test/alpine.sh                                  307
test/asan.sh                                     41
test/ble.sh                                     139
test/bugs.sh                                     43
test/common.sh                                  271
test/common-test.sh                              22
test/coverage.sh                                180
test/cpp-unit.sh                                 48
test/fedora.sh                                   22
test/gentoo.sh                                   83
test/gold.sh                                    168
test/lint.sh                                    324
test/lossless.sh                                148
test/ltrace.sh                                   50
test/nix.sh                                      24
test/nohup.sh                                    89
test/opyc.sh                                    118
test/osh-usage.sh                               213
test/other.sh                                    34
test/parse-err-compare.sh                       138
test/parse-errors.sh                            690
test/process-table-portable.sh                  164
test/process_table.py                           223
test/process-table.sh                           171
test/py2_lint.py                                107
test/py3_lint.py                                 19
test/py_stdlib.sh                                32
test/report.R                                    54
test/runtime-errors.sh                        1,135
test/sh-assert.sh                               151
test/shebang.sh                                  26
test/shell-vs-shell.sh                          314
test/sh_spec.py                               1,424
test/signal-state.sh                             96
test/smoosh_import.py                            31
test/smoosh.sh                                  220
test/spec-alpine.sh                             154
test/spec-bin.sh                                273
test/spec-common.sh                              93
test/spec-cpp.sh                                361
test/spec_lib.py                                226
test/spec-py.sh                                 175
test/spec-runner.sh                             377
test/spec.sh                                    956
test/spec-util.sh                                41
test/spec-version.sh                            128
test/stateful.sh                                232
test/syscall.py                                 219
test/syscall.sh                                 411
test/tools-deps.sh                               76
test/tsv-lib.sh                                 111
test/tsv-lib-test.sh                             72
test/unit.sh                                    289
test/vagrant.sh                                  54
test/wild_report.py                             813
test/wild-runner.sh                             204
test/wild.sh                                    729
test/ysh-every-string.sh                        192
test/ysh-ify.sh                                 634
test/ysh-parse-errors.sh                      1,587
test/ysh-runtime-errors.sh                      912

16,730 lines in 63 files  

Test Automation

asdl/TEST.sh                                     90
core/TEST.sh                                     22
cpp/TEST.sh                                     111
data_lang/TEST.sh                                35
frontend/TEST.sh                                 21
mycpp/TEST.sh                                   339
opy/TEST.sh                                     270
pea/TEST.sh                                     336
yaks/TEST.sh                                     84

1,308 lines in 10 files  

mycpp Translator

This prototype uses the MyPy frontend to translate statically-typed Python to C++. The generated code calls a small runtime which implements things like List[T], Dict[K, V], and Python's len().

mycpp/compare_pairs.py                           60
mycpp/const_pass.py                             531
mycpp/cppgen_pass.py                          3,049
mycpp/crash.py                                   38
mycpp/debug_pass.py                             465
mycpp/format_strings.py                         114
mycpp/mops.py                                   168
mycpp/mycpp_main.py                             377
mycpp/mylib.py                                  467
mycpp/pass_state.py                              93
mycpp/util.py                                    21

5,383 lines in 12 files  

mycpp Test Data

Small Python examples that translate to C++, compile, and run.

mycpp/examples/asdl_generated.py                 65
mycpp/examples/cartesian.py                      78
mycpp/examples/cgi.py                            62
mycpp/examples/classes.py                       298
mycpp/examples/containers.py                    235
mycpp/examples/control_flow.py                  113
mycpp/examples/escape.py                         70
mycpp/examples/fib_iter.py                       53
mycpp/examples/fib_recursive.py                  49
mycpp/examples/files.py                          64
mycpp/examples/__init__.py                        0
mycpp/examples/invalid_condition.py              31
mycpp/examples/invalid_default_args.py           44
mycpp/examples/invalid_except.py                 38
mycpp/examples/invalid_format_args.py            15
mycpp/examples/invalid_format_strings.py         20
mycpp/examples/invalid_global.py                 18
mycpp/examples/invalid_print.py                  13
mycpp/examples/invalid_switch.py                 84
mycpp/examples/invalid_try_else.py               38
mycpp/examples/invalid_types_2.py                31
mycpp/examples/invalid_types.py                  31
mycpp/examples/length.py                        109
mycpp/examples/lexer_main.py                     47
mycpp/examples/loops.py                         177
mycpp/examples/modules.py                        81
mycpp/examples/parse.py                         271
mycpp/examples/pgen2_demo.py                    106
mycpp/examples/scoped_resource.py               198
mycpp/examples/test_arith_ops.py                 45
mycpp/examples/test_cast.py                     208
mycpp/examples/test_classes_gc.py               212
mycpp/examples/test_conditional.py               66
mycpp/examples/test_default_args.py              75
mycpp/examples/test_globals.py                   62
mycpp/examples/test_hoist.py                     61
mycpp/examples/test_integers.py                  74
mycpp/examples/test_io_os_error.py              131
mycpp/examples/test_iterators.py                101
mycpp/examples/test_small_str.py                 33
mycpp/examples/test_strings.py                  253
mycpp/examples/test_switch.py                    80
mycpp/examples/tuple_return_value.py             54
mycpp/examples/varargs.py                        49

3,943 lines in 45 files  

Zephyr ASDL

A DSL for algebraic data types, borrowed from Python. Oils is the most strongly typed Bourne shell implementation!

asdl/asdl_main.py                               299
asdl/ast.py                                     238
asdl/format.py                                  518
asdl/front_end.py                               514
asdl/gen_cpp.py                                 823
asdl/gen_python.py                              610
asdl/pybase.py                                   51
asdl/runtime.py                                  67
asdl/util.py                                     11
asdl/visitor.py                                 136

3,267 lines in 11 files  

pgen2 Parser Generator

An LL(1) parser generator used to parse YSH expressions. Also borrowed from CPython.

pgen2/driver.py                                 101
pgen2/grammar.py                                303
pgen2/parse.py                                  220
pgen2/pgen.py                                   428
pgen2/pnode.py                                   67
pgen2/tokenize.py                               579
pgen2/token.py                                  149

1,847 lines in 8 files  

Other Code Generators

In order to make Oils statically typed, we had to abandon Python reflection and use C++ source code generation instead. The lexer, flag definitions, and constants can be easily compiled to C++.

core/optview_gen.py                              94
cpp/embedded_file_gen.py                         66
doctools/help_gen.py                            640
frontend/consts_gen.py                          624
frontend/flag_gen.py                            533
frontend/lexer_gen.py                           495
frontend/option_gen.py                           94
frontend/signal_gen.py                          105
osh/arith_parse_gen.py                          100
ysh/grammar_gen.py                              244

2,995 lines in 11 files  

Yaks

Experimental replacement for mycpp

yaks/gen_cpp.py                                 104
yaks/transform.py                               250
yaks/yaks_main.py                               134

488 lines in 4 files  

Hand-written C++ Code

Includes OS bindings. Small C++ files like cpp/osh_arith_parse.{cc,h} correspond to larger Python files like osh/arith_parse.py.

cpp/core.cc                                     392
cpp/core.h                                      273
cpp/data_lang.cc                                255
cpp/data_lang.h                                  32
cpp/embedded_file.h                              18
cpp/fanos.cc                                     57
cpp/fanos.h                                      18
cpp/fanos_shared.h                               49
cpp/frontend_flag_spec.cc                       231
cpp/frontend_flag_spec.h                        151
cpp/frontend_match.cc                           134
cpp/frontend_match.h                             82
cpp/frontend_pyreadline.cc                      336
cpp/frontend_pyreadline.h                        73
cpp/libc.cc                                     237
cpp/libc.h                                       38
cpp/osh.cc                                      161
cpp/osh.h                                        50
cpp/osh_tdop.cc                                  16
cpp/osh_tdop.h                                   52
cpp/pgen2.cc                                     44
cpp/pgen2.h                                      85
cpp/preamble.h                                   44
cpp/pylib.cc                                     58
cpp/pylib.h                                      22
cpp/stdlib.cc                                   229
cpp/stdlib.h                                    170
cpp/translation_stubs.h                          38

3,345 lines in 29 files  

Garbage-Collected Runtime

Uses a fork-friendly Mark-Sweep collector.

mycpp/common.h                                   92
mycpp/comparators.h                              65
mycpp/gc_alloc.h                                256
mycpp/gc_builtins.cc                            467
mycpp/gc_builtins.h                             175
mycpp/gc_dict.h                                 470
mycpp/gc_list.h                                 514
mycpp/gc_mops.cc                                 36
mycpp/gc_mops.h                                 116
mycpp/gc_mylib.cc                               283
mycpp/gc_mylib.h                                391
mycpp/gc_obj.h                                  179
mycpp/gc_slab.h                                  58
mycpp/gc_str.cc                                 613
mycpp/gc_str.h                                  212
mycpp/gc_tuple.h                                149
mycpp/hash.cc                                    31
mycpp/hash.h                                     18
mycpp/mark_sweep_heap.cc                        438
mycpp/mark_sweep_heap.h                         294
mycpp/runtime.h                                  22

4,879 lines in 22 files  

Unit tests in C++

The goal is to make the spec tests pass, but unit tests are helpful too.

cpp/core_test.cc                                417
cpp/data_lang_test.cc                           143
cpp/data_race_test.cc                           206
cpp/frontend_flag_spec_test.cc                  154
cpp/frontend_match_test.cc                       87
cpp/libc_test.cc                                276
cpp/obj_layout_test.cc                          188
cpp/osh_test.cc                                  50
cpp/pylib_test.cc                                52
cpp/stdlib_test.cc                              158
cpp/unicode_test.cc                              71
mycpp/bump_leak_heap_test.cc                     62
mycpp/float_test.cc                             131
mycpp/gc_builtins_test.cc                       367
mycpp/gc_dict_test.cc                           697
mycpp/gc_heap_test.cc                           494
mycpp/gc_list_test.cc                           489
mycpp/gc_mops_test.cc                            71
mycpp/gc_mylib_test.cc                          335
mycpp/gc_stress_test.cc                         222
mycpp/gc_str_test.cc                          1,514
mycpp/gc_tuple_test.cc                          139
mycpp/mark_sweep_heap_test.cc                   336
mycpp/small_str_test.cc                         502
mycpp/yaks_runtime_test.cc                      414

7,575 lines in 26 files  

Incremental C++ Build

asdl/NINJA_subgraph.py                           56
bin/NINJA_subgraph.py                           103
build/ninja_lib.py                              499
build/ninja_lib_test.py                         253
build/ninja_main.py                             428
build/ninja-rules-cpp.sh                        366
build/ninja-rules-py.sh                         349
core/NINJA_subgraph.py                           58
cpp/NINJA_subgraph.py                           228
data_lang/NINJA_subgraph.py                      66
frontend/NINJA_subgraph.py                      175
mycpp/NINJA_subgraph.py                         416
NINJA-config.sh                                 137
osh/NINJA_subgraph.py                            32
pea/NINJA_subgraph.py                            19
prebuilt/NINJA_subgraph.py                       76
yaks/NINJA_subgraph.py                           89
ysh/NINJA_subgraph.py                            39

3,389 lines in 19 files  

Build Automation

build/clean.sh                                   65
build/c_module_srcs.py                           98
build/c_module_toc.py                            51
build/common.sh                                  83
build/cpp.sh                                     40
build/cpython_defs.py                           515
build/cpython-defs.sh                           354
build/deps.sh                                 1,091
build/detect-cc.c                                 4
build/detect-pwent.c                              9
build/detect-readline.c                          19
build/dev-setup-test.sh                          30
build/dev.sh                                      5
build/dev-shell.sh                              108
build/dev-shell-test.sh                          95
build/doc.sh                                    662
build/dynamic_deps.py                           155
build/dynamic-deps.sh                           224
build/hello.mk                                   51
build/make_zip.py                                53
build/native.sh                                 116
build/ninja_lib.py                              499
build/ninja_main.py                             428
build/ninja-rules-cpp.sh                        366
build/ninja-rules-py.sh                         349
build/oil.mk                                     61
build/old-ovm-test.sh                            42
build/ovm-actions.sh                            190
build/ovm-compile.sh                            430
build/portable-rules.mk                          96
build/py2.sh                                     14
build/py.sh                                     442
build/stamp.sh                                   76
configure                                       447
install                                         113
Makefile                                        196

7,577 lines in 37 files  

Release Automation

devtools/release-history.sh                     207
devtools/release-native.sh                      120
devtools/release-note.sh                        265
devtools/release-patch.sh                        26
devtools/release.sh                             812
devtools/release-version.sh                   1,023

2,453 lines in 7 files  

Soil: Multi-cloud CI with containers

soil/collect_json.py                             35
soil/common.sh                                   85
soil/diagnose.sh                                132
soil/github-actions.sh                          139
soil/github-tool.sh                              43
soil/history.sh                                  78
soil/host-shim.sh                               384
soil/__init__.py                                  0
soil/maybe-merge.sh                             151
soil/sourcehut.sh                                81
soil/tests.sh                                    20
soil/timeout-test.sh                             50
soil/travis.sh                                  125
soil/wait.sh                                    142
soil/web-init.sh                                165
soil/web.py                                     811
soil/web-remote-test.sh                          43
soil/web.sh                                     180
soil/web_test.py                                 53
soil/web-worker.sh                              350
soil/worker.sh                                  620

3,687 lines in 22 files  

Benchmarks

benchmarks/autoconf.sh                          147
benchmarks/auto.sh                              110
benchmarks/awk-python.sh                         97
benchmarks/builtin-io.sh                         60
benchmarks/cachegrind.sh                         30
benchmarks/cachegrind_to_tsv.py                  54
benchmarks/callgrind.sh                          36
benchmarks/common.R                              98
benchmarks/common.sh                            100
benchmarks/compute.sh                           614
benchmarks/fake_libc.py                          14
benchmarks/gc-cachegrind.sh                      89
benchmarks/gc.sh                                715
benchmarks/gc_stats_to_tsv.py                    51
benchmarks/gperftools.sh                         60
benchmarks/id.sh                                442
benchmarks/id-test.sh                            41
benchmarks/__init__.py                            0
benchmarks/micro.sh                              45
benchmarks/mimalloc.sh                          107
benchmarks/mycpp.sh                             125
benchmarks/osh-parser.sh                        518
benchmarks/osh-runtime.sh                       432
benchmarks/ovm-build.sh                         479
benchmarks/parse-help.sh                         65
benchmarks/perf.sh                              482
benchmarks/pypy.sh                               42
benchmarks/pytrace.py                            92
benchmarks/pytrace.sh                           184
benchmarks/report.R                           1,312
benchmarks/report.sh                            112
benchmarks/report_test.R                         32
benchmarks/startup.sh                           165
benchmarks/systemtap.sh                          75
benchmarks/time_.py                             251
benchmarks/time-test.sh                         303
benchmarks/tokens.sh                             24
benchmarks/uftrace_allocs.py                    181
benchmarks/uftrace_allocs_test.py                20
benchmarks/uftrace_plugin.py                     99
benchmarks/uftrace.sh                           345
benchmarks/virtual_memory.py                     50
benchmarks/vm-baseline.sh                       176
benchmarks/wedge.R                               97
benchmarks/wedge.sh                              41

8,612 lines in 46 files  

Metrics

metrics/bytecode.R                              388
metrics/bytecode.sh                             143
metrics/cpython-defs.R                           72
metrics/native-code.R                            88
metrics/native-code.sh                          201
metrics/source-code.sh                          585
metrics/tarball.sh                              154

1,631 lines in 8 files  

Generated Python Code

For the Python App Bundle.

_devbuild/gen/arg_types.py                      359
_devbuild/gen/arith_nt.py                         4
_devbuild/gen/demo_lib_asdl.py                  277
_devbuild/gen/expr_asdl.py                      219
_devbuild/gen/find_asdl.py                    1,250
_devbuild/gen/find_nt.py                         10
_devbuild/gen/grammar_nt.py                      73
_devbuild/gen/help_meta.py                      378
_devbuild/gen/hnode_asdl.py                     132
_devbuild/gen/id_kind_asdl.py                   892
_devbuild/gen/id_kind.py                        506
_devbuild/gen/__init__.py                         0
_devbuild/gen/nil8_asdl.py                      450
_devbuild/gen/option_asdl.py                    378
_devbuild/gen/pretty_asdl.py                    249
_devbuild/gen/runtime_asdl.py                 2,060
_devbuild/gen/shared_variant_asdl.py            651
_devbuild/gen/syntax_asdl.py                 12,283
_devbuild/gen/typed_arith_asdl.py               706
_devbuild/gen/typed_demo_asdl.py              1,402
_devbuild/gen/types_asdl.py                     161
_devbuild/gen/value_asdl.py                   2,204
_devbuild/gen/yaks_asdl.py                    2,259

26,903 lines in 24 files  

Doc Tools

doctools/cmark.py                               385
doctools/doc_html.py                            107
doctools/html_head.py                            98
doctools/html_lib.py                             43
doctools/micro_syntax.cc                      1,122
doctools/micro_syntax.re2c.h                    688
doctools/oils_doc.py                            640
doctools/ref_check.py                           184
doctools/spelling.py                            138
doctools/split_doc.py                           151
doctools/src_tree.py                            462
doctools/util.py                                 13
lazylex/html.py                                 416

4,447 lines in 14 files  

Web

web/ajax.js                                     149
web/osh-to-oil.js                                79
web/table/csv2html.py                           425
web/table/table-sort.js                         433

1,086 lines in 5 files