AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm...
Transcript of AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm...
![Page 1: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/1.jpg)
AVL: Algorithm Visualization language
Jiuyang Zhao!! System Tester!Qianxi Zhang!! Project Manager!Qinfan Wu! ! System Integrator!Shining Sun! ! Language Guru!Yu Zheng!! ! System Architect!
![Page 2: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/2.jpg)
Motivation
![Page 3: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/3.jpg)
“A picture is worth a thousand words.”
“Then how about a video?”
![Page 4: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/4.jpg)
Algorithm Visualization
✤ Algorithms are hard
✤ A better way to teach and learn
✤ To see to learn!
![Page 5: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/5.jpg)
Demo
![Page 6: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/6.jpg)
Compile and Run
✤ Save source code (plain text) into some .avl file
✤ Compile:!
✤ avl -o exe sample.avl
✤ ./exe
![Page 7: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/7.jpg)
Compile and Run
Source Code
AVL Compier
CPP Code
G++ Executable
![Page 8: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/8.jpg)
Properties
✤ Visual
✤ Educational
✤ Easy to learn
![Page 9: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/9.jpg)
Syntactic Constructs
✤ C Style language!
✤ New features !
✤ Display and hide keywords!
✤ <begin_display>, <end_display> block!
✤ Subarray & index!
✤ Swap function
![Page 10: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/10.jpg)
Display and Hide
✤ Indicate whether the variable is displayable on screen
✤ Can be used in declaration & expression
✤ Default: hide
display int a[] = {1, 2}; hide int b[] = {3, 4}; !hide a; display b;
display int a[] = {1, 2}; hide int b[] = {3, 4}; <begin_display> a[0] = b[0]; a[1] = b[1]; <end_display>
![Page 11: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/11.jpg)
<begin_display> and <end_display>
✤ Operations between the two tags will be displayed
✤ Only displayable variables will be shown
display int a[] = {1, 2}; hide int b[] = {3, 4}; <begin_display> a[0] = b[0]; a[1] = b[1]; <end_display>
![Page 12: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/12.jpg)
Index & Subarray
✤ Index!
✤ Similar to int type!
✤ Helps to highlight elements inside an array
✤ Subarray!
✤ Convenient expression
display int a[] = {1, 2}; hide int b[] = {3, 4}; index i; <begin_display> for (i=0; i<2; i++) a[i] = b[i]; <end_display>
quicksort(a[0:i]); quicksort(a[i+1:n]);
![Page 13: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/13.jpg)
Swap
✤ Create animation for swapping two elements in one array
temp = a[0]; a[0] = a[1]; a[1] = temp;
swap(a, 0, 1);
![Page 14: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/14.jpg)
Project Management
✤ Weekly meeting
✤ Github
✤ Github commits over time:
![Page 15: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/15.jpg)
Translator Architecture
![Page 16: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/16.jpg)
Scanner (scanner.l)
Parser (parser.y)
Code Generator (code_generator.c)
source program (.avl)
token stream
Abstract Syntax Tree
Semantic Check (type_check.c)
Abstract Syntax Tree
g++ compiler
Symbol Table (sys_table.c)
Library (libavl)
C++ source code file
(.cpp)executable file
![Page 17: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/17.jpg)
array_swap.avl
array_swap.cpp
video
![Page 18: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/18.jpg)
Generator Tools
![Page 19: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/19.jpg)
g++ compiler
AvlTypes.h AvlUtils.h
AvlVisualizer.h AvlVisualizer.cpp
OpenGL
Yacc Lex
LibAVL
![Page 20: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/20.jpg)
Software Development Environment
Modular design
avl/src/ avl/src/avl.c avl/src/scanner.l avl/src/parser.y avl/src/sym_table.c avl/src/type_check.c avl/src/code_generator.c ......
avl/lib/ avl/lib/AvlTypes.h avl/lib/AvlVisualizer.h avl/lib/AvlVisualizer.cpp avl/lib/AvlUtils.h ......
avl/tests/ avl/tests/libavl.test avl/tests/avl.test ......
Translator Library Tests
Strict compiler flags
![Page 21: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/21.jpg)
Run-time environment
![Page 22: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/22.jpg)
configure.ac
Makefile.am src/Makefile.am lib/Makefile.am tests/Makefile.am tests/avl.test/Makefile.am ......
configure
config.h Makefile src/Makefile lib/Makefile tests/Makefile tests/avl.test/Makefile ......
/usr/local/bin/avl /usr/local/include/AvlVisualizer.h /usr/local/include/AvlTypes.h /usr/local/lib/ libavl.a libavl.la libavl.so -> libavl.so.0.0.0 libavl.so.0 -> libavl.so.0.0.0 libavl.so.0.0.0
./configure
make && make install souce code
Flex, Bison, Gcc
FreeGLUT
autoconf automake
libtool
![Page 23: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/23.jpg)
How to install avl to your system:$ tar xvzf avl.tar.gz $ cd avl $ ./configure $ make $ sudo make install
$ avl --help Usage: avl [-h|-o|-t] file Options: -h --help Display this information -o --output=<file> Compile and place the executable into <file> -t --translate Translate the source files into c++ xxx.avl -> xxx.cpp Use at most one option at a time. For bug reporting instructions, please see:<https://github.com/wqfish/avl>.
How to use our compiler:
Examples:$ avl test.avl $ ./a.out
$ avl -o test test.avl $ ./test
Everything is fully GNU standards-
compliant
![Page 24: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/24.jpg)
Test Tool
✤ Automake in GNU will generate automatic test suite harness
✤ Command: make check
✤ result of each test case
✤ log file for each test case
✤ statistics
✤ Output
![Page 25: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/25.jpg)
Test Plan
✤ Test cases:!
✤ Covering every line of grammar!
✤ Displaying every objects (data types)!
✤ XFail cases for scope/type checking
![Page 26: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/26.jpg)
Conclusion
✤ What we have learned
✤ Why everyone should use your language fun!
![Page 27: AVL: Algorithm Visualization languageaho/cs4115/lectures/14-05-14_Team1_AVL.pdf · AVL: Algorithm Visualization language Jiuyang Zhao!! System Tester! Qianxi Zhang!! Project Manager!](https://reader034.fdocuments.us/reader034/viewer/2022043002/5f805e1be55f3158ae3f0d68/html5/thumbnails/27.jpg)
Thank you!
AVL Team Presents