ChartLan Yibo Zhu, Xiuming Dou, Xiang Ma, Ziyue Chen, Xiao Xu - - PowerPoint PPT Presentation

chartlan
SMART_READER_LITE
LIVE PREVIEW

ChartLan Yibo Zhu, Xiuming Dou, Xiang Ma, Ziyue Chen, Xiao Xu - - PowerPoint PPT Presentation

ChartLan Yibo Zhu, Xiuming Dou, Xiang Ma, Ziyue Chen, Xiao Xu Overview O Based on C-Like language O More efficient and convenience for user to handle array type data. O Specified in Array Creating , information storing, retrieving, data


slide-1
SLIDE 1

ChartLan

Yibo Zhu, Xiuming Dou, Xiang Ma, Ziyue Chen, Xiao Xu

slide-2
SLIDE 2

Overview

O Based on C-Like language O More efficient and convenience for user to

handle array type data.

O Specified in Array Creating , information

storing, retrieving, data appending and computing.

O Smart basic operations : inserting,

concatenating, indexing and print Array

O Smart mathematic operations between

array and integer: “.+”,”.*”,”.-”,”./”

slide-3
SLIDE 3

Schedule

*: Finally, we are proceeding the last step and we endeavor to do our best.

slide-4
SLIDE 4

Language Structure

slide-5
SLIDE 5

Details

O Static Scoped / No nested function

declaration

O Stack-based Bytecode O C-style like language O No strongly typed O Staticly Typed (Compiler can determine type) O Global/Local Variable Declaration

slide-6
SLIDE 6

Details(cond.)

O Data Type: int, string, array. O Int 0 and 1: Act as Boolean false and true. O Array: List of integers O String (Array of chars) O Function Declaration: def <type> <fname> <argu> O Execution Control: if…else…, while O Array Operations: Indexing, Printarray, Append,

Insert.

slide-7
SLIDE 7

Data Structure

Main() ain() … Formals a func f local variable x … … fp sp X[3]= ]=3 X[2]=2 X[1]=1 X[0]=0 def int f(a){ IntArray x = CreateArray (0,1,2,3); … … }

slide-8
SLIDE 8

Sample Code

O intarray[4] x;

def int main(){ x=%(3,4,5)%+12; printarray(x); return 2;} () #~insert an element into the back of the array~#

O Ou

Outp tput: ut: 3,4 ,4,5 ,5,12

O def int main(){ intarray[3] x; int a;

x=%(1,2,3)%; a = x[2]; print(a); return 2;} #~indexing~#

O Ou

Outp tput: ut: 3

slide-9
SLIDE 9

Sample Code

O def int main() { intarray[3] x; intarray[3] y;

x=%(1,2,3)%; y=x.*2; printarray(y); return 1;} #~dot-operation of array~#

O Ou

Outp tput: ut: 2,4 ,4,6 ,6

O def int main(){ intarray[3] x; intarray[3] y;intar

ray[6] z;x=%(1,2,3)%;y=%(4,5,6)% ;z=x*y; pri ntarray(z); return 2;} #~This program test the Array append by *~ #

O Ou

Outp tput: ut: 1,2 ,2,3 ,3,4,5 ,4,5,6 ,6

slide-10
SLIDE 10

Lesson Learned

O Ocaml is hard but powerful. O Everything should be scheduled before

executing.

O Acting as a team is the most important

element

O Thanks for the whole semester’s class.