Overview of the xargs implementation
masterxargs. It is intended to provide the functionality of the standard GNU xargs utility within the Oils environment.repository·master·Indexed 25 days ago
https://github.com/oils-for-unix/oilsOils is a modern upgrade path from bash, providing a better language and runtime via OSH for shell script compatibility and YSH for Python or JavaScript backgrounds. This documentation covers the Oils builtin architecture, J8 notation implementations, Docker image usage, and the mycpp Python-to-C++ translator, including its specific patterns for switch statements, RAII, and downcasting.
xargs. It is intended to provide the functionality of the standard GNU xargs utility within the Oils environment.class statement to describe the extension module and its constituent extension types.mycpp runtime. It uses the NIL8 syntax, which is a Lisp-ish Intermediate Representation (IR) with imperative semantics. Yaks is designed to be human-readable and can be written by hand or generated losslessly from other languages (like Python) to provide precise type errors including file, line, and column information.The mycpp translator targets a custom-built runtime that implements garbage-collected data structures and core Python-like functionality. Key components include:
mycpp/gc_builtins.{h,cc} provides functionality similar to Python's __builtin__ (e.g., int(), str()).mycpp/gc_mylib.{h,cc} provides utility functions (e.g., mylib.BufWriter similar to cStringIO.StringIO).Key Differences from CPython:
int or mylib.BigInt instead of Python's arbitrary-precision integers.s.strip() uses ASCII whitespace (consistent with JSON/J8) and does not include characters like \v.NUL bytes are permitted in arguments to syscalls like open().TSV8 is the primary exterior data format used in the Oils design for representing tables. It is designed to be both human-readable and machine-readable, serving as a bridge between raw lines and structured rows.
Key characteristics:
table --by-col).The Oils repository is organized into several functional areas:
bin/: Main entry points (e.g., bin/osh).frontend/: Common input and lexing for OSH and YSH.osh/: OSH parsers and evaluators.ysh/: YSH parser and evaluator.data_lang/: JSON-based languages.core/: Shared code between OSH and YSH.builtin/: Builtin commands and functions.pylib/: Python standard library components.tools/: User-facing tools like the osh2oil translator.display/: User interface components.asdl/: ASDL implementation.pgen2/: Parser Generator.mycpp/: Experimental translator from typed Python to C++ (requires MyPy).pea/: Experimental cleaner version of mycpp.opy/: Obsolete Python compiler.Oils shell programs can be built using several well-defined data notations and text interchange formats. The primary notations supported include:
All J8 notation is encoded in UTF-8.
QSN is a data format designed for representing byte strings. It is an adaptation of Rust's string literal syntax, using single quotes instead of double quotes to avoid confusion with JSON.
Note: As of January 2024, QSN has been replaced by J8 Notation, which is more harmonized with JSON. Use J8 Notation for new projects if possible.
find directory contains an implementation of the GNU find utility. It is built using pgen2 and ASDL, following the same architectural patterns used in the Oil project.