1 / 19

Introduction to GAIGS XML Scripting

Introduction to GAIGS XML Scripting. Integrating Algorithm Visualization into Computer Science Education Grand Valley State University June 13-16, 2006. What is GAIGS?. GAIGS stands for G eneralized A lgorithm I llustration via G raphical S oftware

violet
Télécharger la présentation

Introduction to GAIGS XML Scripting

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. Introduction to GAIGS XML Scripting Integrating Algorithm Visualization into Computer Science Education Grand Valley State University June 13-16, 2006

  2. What is GAIGS? • GAIGS stands forGeneralized Algorithm Illustration via Graphical Software • It is an algorithm visualization scripting language that captures and renders snapshots of the state of an algorithm at interesting events – critical points in its execution. • It provides high level support for data structures, interactive questions, documentation, and pseudocode.

  3. What is XML? • XML stands for Extensible Markup Language • It is a meta-language that is used to define other languages • It uses a tag set and an associated syntax which is defined by the XML user • looks like HTML • Often used to define data description languages

  4. Overall GAIGS XML Script Structure • A GAIGS script is defined in a show file • The show file contains XML specifications • Uses the .sho extension in the file name (e.g., test.sho) • The general script structure is: • one or more snapshots • followed by an optional question collection • The show file could be created by hand, or (more usually) as the output of a script generating program

  5. Example of Overall Script Structure <show> <snap> … </snap> <snap> … </snap> <snap> … </snap> <questions> … </questions> </show> A Show File with Three Snapshots and a Question Collection

  6. Defining an XML Grammar • The structure of an XML grammar is defined in a DTD file - a collection of Document Type Definitions • XML files can then be validated against the DTD <!ELEMENTshow (snap+, questions?)> DTD for the Show Element

  7. Snapshot Structure • A snapshot defines an interesting moment in an algorithm’s execution • It includes a title, possible references to documentation and pseudocode, the data structure(s), and a possible question reference <!ELEMENTsnap ( title, doc_url?, pseudocode_url?, (tree|array|graph|stack|queue|linkedlist|bargraph|node)*, question_ref? )> <!ELEMENTtitle (#PCDATA)> DTDs for the Snap and Title Elements

  8. The Basic GAIGS Data Structures • array • one or two dimensional • bargraph • graph • directed or undirected, weighted or not • linkedlist • queue • stack • tree • binary or general A General Tree

  9. Sample Structure: The Stack • Stacks contain list items, as do arrays, queues, and linked lists • Each list item has an associated label <!ELEMENTstack (name?, bounds?, list_item*)> <!ELEMENTlist_item (label)> <!ATTLISTlist_item color CDATA "#FFFFFF"> <!ELEMENTlabel(#PCDATA)> DTDs for the Stack, List Item, and Label Elements

  10. Stack Example <snap> <title>My Stack</title> <stack> <list_item color="#FF0000"> <label>8</label> </list_item> . . . <list_item color="#FF0000"> <label>10</label> </list_item> <list_item color="#0000FF"> <label>6</label> </list_item> </stack> </snap>

  11. Positioning a Data Structure • Each of the data structures can be positioned in the view window • The view window is defined as one unitwide and high • 0,0 is the bottom left corner <!ELEMENTbounds (EMPTY)> <!ATTLISTbounds x1 CDATA #REQUIRED y1 CDATA #REQUIRED x2 CDATA #REQUIRED y2 CDATA #REQUIRED fontsize CDATA "0.03"> DTD for the Bounds Element

  12. Positioning Example • The example code positions the stack in the left half of the view window • Note that the font size used by the structure can be set within the bounds tag as well - this affects the size of the structure elements as well <snap> <title>My Stack</title> <stack> <bounds x1="0.0" y1="0.0" x2="0.5" y2="1.0" fontsize="0.035" /> <list_item color="#FF0000"> <label>8</label> </list_item> . . . </stack> </snap>

  13. Two Requirements for Show Files • Show file contents must be preceded by the two lines shown below • The first is a processor instruction that specifies the XML version and the character encoding • The second, the doctype, specifies the DTD to use with the show file <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPEshowPUBLIC "-//JHAVE//DTD GAIGS SHO//EN" "gaigs_sho.dtd">

  14. A Simple, but Complete, Example <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPEshowPUBLIC "-//JHAVE//DTD GAIGS SHO//EN" "gaigs_sho.dtd"> <show> <snap> <title>Stack Example</title> <stack> <list_item color="#FF0000"> <label>10</label> </list_item> </stack> </snap> <snap> <title>Stack Example</title> <stack> <list_item color="#FF0000"> <label>8</label> </list_item> <list_item color="#FF0000"> <label>10</label> </list_item> </stack> </snap> </show>

  15. Adding Documentation • Each snapshot can have an associated webpage by specifying a url • This webpage is shown in the info pane of the JHAVÉclient <!ELEMENTsnap ( title, doc_url?, pseudocode_url?, (tree|array|graph|stack|queue|linkedlist|bargraph|node)*, question_ref? )> <!ELEMENTdoc_url (#PCDATA)> DTDs for the Snap and Doc URL Elements

  16. f • f

  17. Adding Pseudocode • Each snapshot can have associated pseudocode by specifying a url • This webpage is shown in the pseudocode pane of the JHAVÉclient • JHAVÉ supports a particular pseudocode design, but this is not a ShowFile issue (i.e. is a topic for another session). <!ELEMENTsnap ( title, doc_url?, pseudocode_url?, (tree|array|graph|stack|queue|linkedlist|bargraph|node)*, question_ref? )> <!ELEMENTpseudocode_url (#PCDATA)> DTDs for the Snap and Pseudocode_url Elements

  18. f • f

  19. Example with Documentationand Pseudocode <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPEshowPUBLIC "-//JHAVE//DTD GAIGS SHO//EN" "gaigs_sho.dtd"> <show> <snap> <title>Stack Example</title> <doc_url>http://www.alma.edu/b.htm</doc_url> <pseudocode_url>http://www.alma.edu/bc.htm</pseudocode_url> <stack> <list_item color="#FF0000"> <label>8</label> </list_item> <list_item color="#FF0000"> <label>10</label> </list_item> </stack> </snap> </show>

More Related