Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Languages and Translators Prof. Stephen Edwards, Fall 2003 Team Members: Haronil Estevez ~ Diana Jackson ~ Catherine MacInnes ~ Adam Rosenzweig.

Similar presentations


Presentation on theme: "Programming Languages and Translators Prof. Stephen Edwards, Fall 2003 Team Members: Haronil Estevez ~ Diana Jackson ~ Catherine MacInnes ~ Adam Rosenzweig."— Presentation transcript:

1 Programming Languages and Translators Prof. Stephen Edwards, Fall 2003 Team Members: Haronil Estevez ~ Diana Jackson ~ Catherine MacInnes ~ Adam Rosenzweig

2 CHAD: Overview  An interpreted language  Interpreter creates a graphical display of the program  5 native data types  Integers  Strings  Arrays  Queues  Stacks  Types have native operations  Used to implement most algorithms

3 CHAD: Motivation  Graphic representations are a very powerful teaching tool  Teachers don't want to spend a lot of time coding an algorithm just so that their students can see what is going on  There are no current languages which make it easy to graphically represent algorithms  In CHAD you can write a graphical representation of simple algorithms in less than 15min.

4 CHAD: Tutorial  Program Order/Structure: Declarations, Expressions, Functions  Declarations terminate in semicolon  Control Statements end in an end keyword for appropriate type (e.g. if/endif, else/endelse, for/endfor)  Most CHAD Types have the same syntactical structure and typical operations as the most common languages  Supports comments (// /* */)

5 CHAD: Tutorial  Integers Typical Operations (add,multiply,mod,compare) Functions: Min(a,b) and Max(a,b)  Strings Operations: (assignment =, concatenation +, comparison==)  Arrays Syntax: array[int|string, size] a; Functions: a.sortAZ(begin, end), a.sortZA(begin, end), a.swap(i,j)  Queues Syntax: queue[int|string] q; Functions: q.enqueue(1); q.dequeue();  Stacks Syntax: stack[int|string] s; Functions: s.push(“string”); s.pop();  Functions Syntax: function [return type] functionName(parameters) Body of Declarations Body of Expressions Return statement endfunction

6 CHAD: Tutorial  Insertion Sort  Primary Focus(red), Secondary Focus(green) handled by Interpreter  Detailed description/explanation in final report

7 CHAD: Implementation Lexer (CHADLexer) and Parser (CHADParser) written in ANTLR Two tree walkers implemented with ANTRL –StaticCHADWalker: performs static semantics analysis –CHADWalker: the interpreter CHADWalker ERROR StaticCHADWalker Load CHAD Source File RUN/STEP through Program Parsing/Static Semantic Error Creation/Change In Visible Data Structure CHAD GUI CHADLexer/CHADParser CHADGUI Update CHADType class stores built-in types/data structures CHADType object used by interpreter to evaluate binary operations and execute built-in functions

8 CHAD: Implementation CHAD GUI written with Java Swing and gives users the ability to load/run CHAD programs GUI uses CHADParser to detect parser errors and StaticCHADWalker to perform static semantics analysis before allowing user to run CHAD program CHADWalker ERROR StaticCHADWalker Load CHAD Source File RUN/STEP through Program Parsing/Static Semantic Error Creation/Change In Visible Data Structure CHAD GUI CHADLexer/CHADParser CHADGUI Update GUI's "Step" button triggers use of CHADWalker to step through execution of the program one step at a time GUI's “Run" button triggers use of CHADWalker to run through execution of entire program GUI only displays data structures that are marked "visible" by the interpreter

9 CHAD: Summary  Simple language to implement basic algorithms with familiar syntax  Automatic animations of algorithms  Excellent instructional tool

10 CHAD: Future Paths  More basic data structures implemented  Linked lists  Trees  Graphs, etc.  Enhanced simulator functionality  Variable timed run steps  More code-control over displayed variables

11 CHAD: Lessons Learned  Multiple paths to all goals  Every time you think about it, you’ll find something else you didn’t handle yet  So, start early and stay ahead  Keep all members up to date on each aspect of project (especially if it’s a part they’re not working on)  Provide more descriptive error messages -> easier to debug


Download ppt "Programming Languages and Translators Prof. Stephen Edwards, Fall 2003 Team Members: Haronil Estevez ~ Diana Jackson ~ Catherine MacInnes ~ Adam Rosenzweig."

Similar presentations


Ads by Google