1 / 28

Programming in Several Dimensions

Programming in Several Dimensions. Paul Lyons Massey University. Textual Languages are One-dimensional. How about programs?. Computers are sequential. Input devices Output devices Memory addresses Accumulator Buses Parsers. Flow of control Sequential syntax Tree-structured semantics

nura
Download Presentation

Programming in Several Dimensions

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. Programming in Several Dimensions Paul Lyons Massey University

  2. Textual Languages are One-dimensional How about programs? Computers are sequential. Input devices Output devices Memory addresses Accumulator Buses Parsers Flow of control Sequential syntax Tree-structured semantics Declarations Tree-structured Inverted w.r.t. procedures I/O Asynchronous

  3. Computers Support Multi-dimensionality Power Easy 2-D input High-res 2-D and 3-D graphic output Multiple window support Synchronous updating Hyperlinks

  4. A Multi-dimensional Language Desiderata High-level Multiple views Non-sequential access Easy editing Efficient space use Mid-level Control relationships Text where appropriate Graphics where appropriate Low-level Group related concepts Purge brackets

  5. Subprog HyperPascal Visualisations hyperlinks Action Tree Scope Tree

  6. main prog subprog2 subprog3 Subprog HyperPascal Visualisations hyperlinks Action Tree Scope Tree

  7. main prog subprog2 subprog3 Subprog Subprog out1 out2 out3 string string boolean in1 real in2 real Action Tree var1 var2 string integer HyperPascal Visualisations hyperlinks Action Tree Scope Tree

  8. subprog1 subprog3 subprog1 Main prog Subprog subprog3 A<3 “John” names & & “, ” “Jenna” X+7 B sum/9 average HyperPascal Visualisations hyperlinks Action Tree Scope Tree

  9. HyperPascal Structure Template Visualisation Dot-and-caret notation Pictorial notation new(newNode); newNode^.data := x; if L = nil then begin L := newNode^.next := L; newNode; end else begin parent := nil; thisNode := L; status := running; while status = running do begin if (thisNode^.data > x) or (thisNode = nil)_then begin newNode^.next := thisNode; if parent = nil then L := newNode else parent^.next := newNode; status = finished; end {then clause} else begin parent := thisNode; thisNode := thisNode^.next; end {if}; end; end;

  10. new(newNode); newNode^.data := x; if L = nil then begin newNode^.next := L; L := newNode; end else begin {L isn’t nil} parent := nil; thisNode := L; status := running; while status = running do begin if (thisNode^.data > x) or (thisNode = nil)_then begin newNode^.next := thisNode; if parent = nil then L := newNode else parent^.next := newNode; status = finished; end {then clause} else begin {the node goes somewhere else} parent := thisNode; thisNode := thisNode^.next; end {if}; end; end; parent := nil; thisNode := L; HyperPascal Structure Template Visualisation Dot-and-caret notation Pictorial notation new(newNode); newNode^.data := x; if L = nil then begin L := newNode^.next := L; newNode; end else begin parent := nil; thisNode := L; status := running; while status = running do begin if (thisNode^.data > x) or (thisNode = nil)_then begin newNode^.next := thisNode; if parent = nil then L := newNode else parent^.next := newNode; status = finished; end {then clause} else begin parent := thisNode; thisNode := thisNode^.next; end {if}; end; end;

  11. new(newNode); newNode^.data := x; if L = nil then begin newNode^.next := L; L := newNode; end else begin {L isn’t nil} parent := nil; thisNode := L; status := running; while status = running do begin if (thisNode^.data > x) or (thisNode = nil)_then begin newNode^.next := thisNode; if parent = nil then L := newNode else parent^.next := newNode; status = finished; end {then clause} else begin {the node goes somewhere else} parent := thisNode; thisNode := thisNode^.next; end {if}; end; end; parent := thisNode; thisNode := thisNode^.next;

  12. L L L L L L L top top top top top top top top top top top <=x <=x x L L L >x top top x x >x HyperPascal Structure Template Visualisation Dot-and-caret notation Pictorial notation new(newNode); newNode^.data := x; if L = nil then begin L := newNode^.next := L; newNode; end else begin parent := nil; thisNode := L; status := running; while status = running do begin if (thisNode^.data > x) or (thisNode = nil) then begin newNode^.next := thisNode; if parent = nil then L := newNode else parent^.next := newNode; status = finished; end {then clause} else begin parent := thisNode; thisNode := thisNode^.next; end {if}; end; end;

  13. HyperPascal Pictorial declarations

  14. HyperPascal

  15. L L L L HyperPascal Easy-to-draw pictures

  16. L L HyperPascal Easy-to-draw pictures

  17. L L HyperPascal Easy-to-draw pictures

  18. L L HyperPascal Easy-to-draw pictures >x

  19. L L HyperPascal Easy-to-draw pictures >x

  20. L L HyperPascal Easy-to-draw pictures >x

  21. L L HyperPascal Easy-to-draw pictures >x

  22. L L top top HyperPascal Easy-to-draw pictures x >x

  23. L L L L L L L top top top top top top top top top top top <=x <=x x L >x top top x HyperPascal Easy-to-draw pictures if thisNode <> nil then if thisNode^.data > x then {generate after-picture1} else {thisNode <> nil and thisNode^.data <=x} {generate after-picture 2} else {thisNode = nil} {generate after-picture 3}

  24. Concrete (distorted) view Concrete (distorted) view Concrete (distorted) view abstract (undistorted) view Semantic (parse tree) view HyperPascal Three-layer architecture Draw commands User actions (undistorted coordinates) (undistorted coordinates) Redraw messages Object association information (coordinate-free) (coordinate-free)

  25. HyperPascal FIN

  26. “John” & names “, ” & “Jenna”

  27. L top top top L x HyperPascal Easy-to-draw pictures if thisNode <> nil then if thisNode^.data > x then {generate after-picture1} else {thisNode^.data <=x} {generate after-picture 2} else {thisNode = nil} {generate after-picture 3} if L <> nil then if L^.data > x then {generate after-picture1} else {L^.data <=x} {generate after-picture 2} else {L = nil} if L <> nil then if L^.data > x then {generate after-picture1} else {L^.data <=x} {generate after-picture 2}

More Related