Code Monkey home page Code Monkey logo

time-travel-shell's Introduction

Time Travel Shell

UCLA CS 111 Lab 1 Spring 14

Contributors: Stanway Liau, Colin Fong

Overview

Part A deals with parsing a shell script within a small subset of the standard POSIX shell grammar. Refer to the specification listed below for more details. Part B concerns building the execution model for the shell. In Part C we parallelized the execution of shell commands with no dependencies. The goal was to maintain 100% accuracy but not necessarily 100% parallelization.

Features

  • 1A) Shell script parser

    • Detects invalid grammar
    • Ignores comments
    • Supports detection for subshells
    • Print out a diagnostic with the '-p'flag
  • 1B) Execution model

    • I/O redirections handled (within the specification)
    • Subshells executed appropriately
  • 1C) Parallelization model

    • Turn on parallelization with the '-t' flag

Limitations

  • 1A) Shell script parser

    • Cannot handle append operator '>>'
    • Doesn't support the tokens '((' or '))'
    • Memory leaks galore
  • 1B) Execution model

    • Doesn't support control flow statements such as 'if', 'while', etc.
    • Possibly not closing all opened file descriptors
    • Doesn't support the shell directive 'exec' properly
    • Will not properly handle commands like 'cd' or 'rm'
  • 1C) Parallelization model

    • Doesn't parallelize within each command tree, only amongst command trees
    • Shell prompt may return before all shell commands print out their results
    • More memory leaks introduced

Installation

  1. Clone this repository using 'git clone https://github.com/stanwayl/time-travel-shell'
  2. Create an executable 'timetrash' by running 'make'
  3. Run shell using './timetrash [OPTION] script.sh' within the directory

Ideas for future improvements

If we don't care too much about memory, unify all the different node structures into a single one with all needed fields. Then don't need to worry about type conversions and data structures can just hold a single type of node. Also easier to just go through them all and free them when done.

Specification

http://cs.ucla.edu/classes/spring14/cs111/assign/lab1.html

time-travel-shell's People

Contributors

colinfong avatar

Watchers

James Cloos 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.