Giter Site home page Giter Site logo

cwillu / oil Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oilshell/oil

0.0 1.0 0.0 669 KB

Oil shell

Home Page: http://www.oilshell.org/

License: Apache License 2.0

Python 68.75% C++ 0.63% Shell 29.20% C 0.89% CSS 0.05% HTML 0.21% JavaScript 0.28%
unbelievably-important

oil's Introduction

oil

Oil is a new Unix shell, still in its early stages.

This repo contains a prototype in Python of a very complete bash parser, along with a runtime that is less complete.

The dialect of bash that is recognized is called the osh language. The main goal now is to design the oil language, which shell scripts can be automatically converted to.

After that, the Python dependency can be broken by porting it to C++.

Try it

Clone the repo and run bin/osh. Basic things like pipelines, variables, functions, etc. should work.

bash$ bin/osh
osh$ name=world
osh$ echo "hello $name"
hello world

Build it

Python's builtin glob and fnmatch modules don't match libc in some cases (e.g. character classes). To fix that, build the core/libc.c wrapper:

$ ./pybuild.sh libc

Now bin/osh will use libc's globbing.

Running Tests

There are three kinds of tests: unit tests, spec tests, and "wild tests".

Unit tests are in Python:

$ ./test.sh all-unit
$ ./test.sh unit osh/word_parse_test.py

(test.sh is a simple wrapper that sets PYTHONPATH)

Spec tests are written with the sh_spec.py framework:

$ ./spec.sh setup
$ ./spec.sh smoke   # or other actions

"Wild tests" test the parser against code in the wild. We don't have any golden data to compare against, but whether the parse succeeds or fails is useful for shaking out bugs, sort of like a fuzz test.

$ ./wild.sh this-repo

This will run the parser on shell scripts in this repo, and put the output in _tmp/wild/oil-parsed, which you can view with a web browser.

Code Overview

Try this to show a summary of what's in the repo and their line counts:

$ ./count.sh all

(Other functions in this file that may be useful as well.)

Directory Structure

bin/              # programs to run (bin/osh)
core/             # the implementation (AST, runtime, etc.)
osh/              # osh front end
oil/              # oil front end (empty now)
tests/            # spec tests

pybuild.sh        # build support
setup.py

test.sh           # test scripts
spec.sh
wild.sh
smoke.sh
sh_spec.py        # shell test framework

lint.sh           # static analysis
typecheck.sh

count.sh          # Get an overview of the repo

_tmp/             # For test temp files

Unit tests are named foo_test.py and live next to foo.py.

More info

If you need help using oil, or have general questions, e-mail [email protected].

If you want to contribute, e-mail [email protected].

I have docs that need to be cleaned up and published. For now, there is a fair amount of design information on the blog at oilshell.org.

oil's People

Contributors

andychu avatar

Watchers

Carey Underwood avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.