1 / 11

Programming Languages and Translators Prof. Stephen Edwards, Fall 2003 Team Members:

CHAD. Programming Languages and Translators Prof. Stephen Edwards, Fall 2003 Team Members: Haronil Estevez ~ Diana Jackson ~ Catherine MacInnes ~ Adam Rosenzweig. CHAD: Overview. An interpreted language Interpreter creates a graphical display of the program 5 native data types Integers

galya
Download Presentation

Programming Languages and Translators Prof. Stephen Edwards, Fall 2003 Team Members:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHAD 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 • IntegersTypical Operations (add,multiply,mod,compare) Functions: Min(a,b) and Max(a,b) • StringsOperations: (assignment =, concatenation +, comparison==) • ArraysSyntax: array[int|string, size] a; Functions: a.sortAZ(begin, end), a.sortZA(begin, end), a.swap(i,j) • QueuesSyntax: queue[int|string] q; Functions: q.enqueue(1); q.dequeue(); • StacksSyntax: stack[int|string] s; Functions: s.push(“string”); s.pop(); • FunctionsSyntax: 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 GUI Load CHAD Source File RUN/STEP through Program CHADLexer/CHADParser StaticCHADWalker CHADWalker Parsing/Static Semantic Error Creation/Change In Visible Data Structure ERROR CHADGUI Update CHAD: Implementation • Lexer (CHADLexer) and Parser (CHADParser) written in ANTLR • Two tree walkers implemented with ANTRL • StaticCHADWalker: performs static semantics analysis • CHADWalker: the interpreter • CHADType class stores built-in types/data structures • CHADType object used by interpreter to evaluate binary operations and execute built-in functions

  8. CHAD GUI Load CHAD Source File RUN/STEP through Program CHADLexer/CHADParser StaticCHADWalker CHADWalker Parsing/Static Semantic Error Creation/Change In Visible Data Structure ERROR CHADGUI Update 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 • 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

More Related