Programming Languages and Translators - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Programming Languages and Translators

Description:

Graphic representations are a very powerful teaching tool ... Two tree walkers implemented with ANTRL. StaticCHADWalker: performs static semantics analysis ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 12
Provided by: www1CsC
Category:

less

Transcript and Presenter's Notes

Title: Programming Languages and Translators


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
  • Integers Typical Operations
    (add,multiply,mod,compare)
  • Functions Min(a,b)
    and Max(a,b)
  • Strings Operations (assignment ,
    concatenation , comparison)
  • Arrays Syntax arrayintstring, size a
  • Functions
    a.sortAZ(begin, end), a.sortZA(begin, end),
    a.swap(i,j)
  • Queues Syntax queueintstring q
  • Functions
    q.enqueue(1) q.dequeue()
  • Stacks Syntax stackintstring 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
  • 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
  • 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, youll find
    something else you didnt handle yet
  • So, start early and stay ahead
  • Keep all members up to date on each aspect of
    project (especially if its a part theyre not
    working on)
  • Provide more descriptive error messages -gt easier
    to debug
Write a Comment
User Comments (0)
About PowerShow.com