Code Monkey home page Code Monkey logo

tscript's Introduction

tscript

Description: These files implement an interpreter for the Tscript language. Tscript is a subset of ECMAScript 5.1 defined at UNH for use in the Compiler Design course (CS712/CS812). The interpreter is implemented in Java and uses the ANTLR (version 4) parser generator.

The Tscript interpreter is known as "ts".

This initial version of the interpreter only supports the following features:

  • "var" statement
    • but only declares a single identifier and without initialization
  • expression statement
  • print statement
    • not actually part of ECMAScript 5.1
    • for use until objects and functions are supported
  • expressions
    • assignment
    • add and multiply
    • identifier
    • numeric literal
    • parenthesized subexpressions

The system files are organized into three directories:

	bin - contains bash scripts for building the system.

	src - contains the source code for the interpreter

        src/ts - main class for the interpreter
        src/ts/parser - parser
        src/ts/support - support classes for executing Tscript programs
        src/ts/tree - classes that define the AST (abstract syntax tree)
        src/ts/tree/visit - classes to traverse the AST (uses the visitor pattern)

	scripts - contains templates for the scripts used to run the interpreter

	test - contains test programs for the interpreter

Project Setup

To build and run the system:

  1. Copy the tar file containing the system to your account:

    cp -r ~cs712/public/tscript.tar . 
  2. Un-tar the files:

    tar xvf tscript.tar
  3. Install and build the system:

<pre>cd tscript/bin
bash install.sh </pre>

 This will create a directory, tscript/build, to contain the files
 generated by the build.

 Once an install is done, then you can re-build the system by cd-ing
 to tscript/bin and then:

 <pre>bash build.sh</pre>
  1. While in tscript/bin, test the build by running the regression test suite:

    bash regression.sh

    If all is well, nothing should be printed.

  2. You run the interpreter by executing tscript/build/bin/ts. You can make a bash alias for this script, add its directory to your bash PATH, or even copy the script to where you want to use it.

    The script takes a few optional parameters followed by a single Tscript source file. (See tscript/src/ts/Main.java for a discussion of the parameters.) Therefore to execute a Tscript program:

    ts file.ts

    You must use the "ts" file extension for Tscript programs.

    You can run the interpreter from within the Java debuggger (jdb):

    tsdb file.ts
  3. The build procedure runs javadoc to generate HTML files to document the system. These files are rooted in tscript/build/html.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

tscript's People

Contributors

ericcchamberlain avatar

Watchers

 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.