exec.dvi
|
|
- みりあ やすこ
- 4 years ago
- Views:
Transcription
1 2018 c 6, Mini-C C , 61, print,,, (run ),,, (int ), 7, x, x "a" 3 "b" 4 "x" 10 (, ), x STL map 1 + 2, 1 2,, x = ;, 1, 2 x { 1 ; 2 ; ; m, if ( ) { 1 else { 2, 1,, 2 0, 1, 3 0, 2,,, main 6 1
2 ,, Mini-C (Exp constant) 61 7 x Exp constant::run 1 run, Expression run virtual int run( std::map<std::string,function*>& func, std::map<std::string,int>& gvar, std::map<std::string,int>& lvar ) const = 0; // (1) // // (2) // // (3) //, asth Expression class ( virtual void print ), run 3, ( ) (1), ( ) (2), ( ) (3), ( ) 2, Exp constant run, (value() 1 ),, asth (void print ) int run( std::map<std::string,function*>& func, std::map<std::string,int>& gvar, std::map<std::string,int>& lvar ) const { return value(); 3 map,asth <map>, std::map<std::string,function*> class Function, Function*, #include<map> class Function; 4, Exp function run 2 asth class Exp function int run( std::map<std::string,function*>& func, std::map<std::string,int>& gvar, std::map<std::string,int>& lvar ) const; 1 value 2 St function Exp function, Exp function run, 6 2
3 , astcpp, int Exp function::run( std::map<std::string,function*>& func, std::map<std::string,int>& gvar, std::map<std::string,int>& lvar ) const { return 0; //, ( 65 ) 5, // 51 Expression* c1 = new Exp constant(type INT, 7); Expression* c2 = new Exp constant(type CHAR, x ); // std::cout << c1->run(func, gvar, lvar); std::cout<<std::endl; std::cout << c2->run(func, gvar, lvar); std::cout<<std::endl; x OK (, ) 622 (Exp variable) 62 a x, Exp variable::run 1 asth class Exp variable, run 2 astcpp Exp variable::run, (1),, (2),, (3),, (1) std::map<std::string,int>::const iterator p; if ((p=lvarfind(name()))!=lvarend()) { return p->second; 3 6 3
4 , Expression* v a = new Exp variable("a"); Expression* v n = new Exp variable("n"); Expression* v x = new Exp variable("x"); Expression* v p = new Exp variable("p"); // 3 // lvar["a"] = 4; lvar["x"] = 2000; gvar["x"] = -95; gvar["n"] = 10; // std::cout << v a->run(func,gvar,lvar); std::cout<<std::endl; std::cout << v n->run(func,gvar,lvar); std::cout<<std::endl; std::cout << v x->run(func,gvar,lvar); std::cout<<std::endl; std::cout << v p->run(func,gvar,lvar); std::cout<<std::endl; 4 a ( ) 10 n ( ) 2000 x ( ) undefined variable p OK 623 (Exp operation1) Exp operation1::run 1, (operand()) run, (operation()),, 3, Operator MINUS, -3, operand() NULL (, assert ) 2 // 503 Expression* v = new Exp variable("n"); Expression* o = new Exp operation1(operator MINUS, v); // lvar["n"] = 31; std::cout << o->run(func, gvar, lvar); std::cout<<std::endl; n=31 -n, -31 OK 6 4
5 624 (Exp operation2) Exp operation2::run 1 2 // 504 Expression* v = new Exp variable("n"); Expression* c1 = new Exp constant(type INT, 1); Expression* o1 = new Exp operation2(operator PLUS, v, c1); Expression* c2 = new Exp constant(type INT, 2); Expression* o2 = new Exp operation2(operator MUL, o1, c2); // lvar["n"] = 31; std::cout << o1->run(func, gvar, lvar); std::cout<<std::endl; std::cout << o2->run(func, gvar, lvar); std::cout<<std::endl; n=31, o1=n+1 o2=o1*2, OK 625 (Exp function) 65 gcd(a,b+5) getint() Exp function::run 1 astcpp Exp function::run (1), ; (2) if ( "getint") { getint ; (3) else if ( "getchar") { getchar ; (4) else if ( "putint") { putint ; (5) else if ( "putchar") { putchar ; (6) else { ; (1) aaa(a+1, b*2, 5), (a+1, b*2, 5), a=3, b=5,, (4, 10, 5) ( ) args() run, std::list<int> i args (2) getint, (name()) "getint", std::cin, 6 5
6 int i; std::cin >> i; return i; (2) getchar getint, (3) putint putint, Exp function, St function Exp function,, i args 1 std::cout int i = i argsfront(); // std::cout << i; return 0; (4) putchar putint (5) func, f ( ), f run run, func, gvar, i args std::map<std::string,function*>::const iterator p; else { if ((p=funcfind(name()))!=funcend()) { Function* f = p->second; return f->run(func,gvar,i args); else { Function::run 612,, asth class Function, int run( std::map<std::string,function*>& func, std::map<std::string,int>& gvar, std::list<int>& i args ) const;, astcpp 1 6 6
7 int Function::run( std::map<std::string,function*>& func, std::map<std::string,int>& gvar, std::list<int>& i args ) const { return i argsfront(); // cpp, &, getint(); getchar(); putint(5); putchar( U ); asum(n);, n = (St assgin), 66 St assgin::run 1 run, Statement run virtual Return t run( std::map<std::string,function*>& func, std::map<std::string,int>& gvar, std::map<std::string,int>& lvar ) const = 0; run, func, gvar, lvar run, a=b+3;, return, while(i<n) { if (n%r==0) return r; i++;, return, return,, run, return, return, run int, 2 Return t, (asth #include ) 6 7
8 struct Return t { ; bool val is returned; // return (true/false) int return val; // return, Return t() : val is returned(false), return val(0) { Return t(bool r, int v) : val is returned(r), return val(v) { C++, struct class,, private, class, public, struct, return Return t(false,0), return 7 Return t(true,7) Return t rd, return, rdval is returned true rdreturn val 2 asth St assign run Statement 3 3 astcpp St assign::run (1), NULL assert(lhs()); assert(rhs()); (2) (rhs()) run, (i rhs ) (3) (lhs()), i rhs Exp variable,,, (4), return return Return t(false,0); 4 // i = 0; (506 ) Exp variable* v1 = new Exp variable("i"); Expression* c1 = new Exp constant(type INT, 0); Statement* s1 = new St assign(v1,c1); // std::cout << "before" <<std::endl; // i 5 lvar["i"] = 5; Return t rd = s1->run(func, gvar, lvar); std::cout << "i = " << lvar["i"] <<std::endl; i = 5 i = 0;, i = 0 OK 3 = 0 6 8
9 627 (St list) 67 St list::run 1, iterator run, return,, return, Return t(false,0) for (std::list<statement*>::const iterator it = statements()begin(); it!= statements()end(); it++) { assert(*it); // NULL Return t rd = (*it)->run(func, gvar, lvar); // if (rdval is returned) return rd; // return, rd return Return t(false,0); // return 2 // 507 // s = 0; Exp variable* v1 = new Exp variable("s"); Expression* c1 = new Exp constant(type INT, 0); Statement* s1 = new St assign(v1,c1); // i = -n; Exp variable* v2 = new Exp variable("i"); Exp variable* v3 = new Exp variable("n"); Expression* e1 = new Exp operation1(operator MINUS, v3); Statement* s2 = new St assign(v2,e1); std::list<statement*> slist; slistpush back(s1); slistpush back(s2); Statement* s3 = new St list(slist); // lvar["s"] = 123; lvar["i"] = 456; lvar["n"] = 5; Return t rd = s3->run(func, gvar, lvar); std::cout << "s = " << lvar["s"] <<std::endl; std::cout << "i = " << lvar["i"] <<std::endl; std::cout << "n = " << lvar["n"] <<std::endl;, s=123, i=456, n=5, s = 0; i = -n;, OK 6 9
10 s = 0 i = -5 n = if (St if) 68 if St if::run 1, condition(), (0 ) then part(), else part(), else part() (, then part() ) 4, then part() run rd rdval is returned true then part() return, rd else part(), Return t(false,0) ( St list, ) 2, Statement* s = make if(); // // lvar["i"] = -5; lvar["s"] = 10; Return t rd1 = s->run(func, gvar, lvar); std::cout << "s = " << lvar["s"] <<std::endl; // lvar["i"] = 7; lvar["s"] = 10; Return t rd0 = s->run(func, gvar, lvar); std::cout << "s = " << lvar["s"] <<std::endl; if (i<0) s = s - i; else s = s + i; s=10, i=-5 s=10, i=7, OK s = 15 s = while (St while) 69 while St while::run 4 condition() NULL, then part() else part() NULL 6 10
11 1 if 2 Statement* s = make while(); // lvar["i"] = -3; lvar["n"] = 3; lvar["s"] = 0; Return t rd = s->run(func, gvar, lvar); std::cout << "i = " << lvar["i"] <<std::endl; std::cout << "n = " << lvar["n"] <<std::endl; std::cout << "s = " << lvar["s"] <<std::endl; while(i<=n) { if (i<0) s = s - i; else s = s + i; i = i + 1; i=-3, n=3, s=0, OK i = 4 n = 3 s = return (St return) 610 return St return::run 1 assert(value()); int rv = value()->run(func,gvar,lvar); return Return t(true,rv); cpp, &, while(i<=n) { if (i<0) s = s - i; else return s; i = i + 1;, i 0, OK 6 11
12 i = -3 n = 3 s = 0 rdval is returned = 1 rdreturn val = (St function) 611 St function::run 1 function run, Return t(false,0) 2 std::list<expression*> arglist; arglistpush back(new Exp variable("a")); Statement* s = new St function("putint", arglist); lvar["a"] = -3249; Return t rd = s->run(func, gvar, lvar); a=-3249 putint(a), OK 6212 (Function) Function::run, func gvar i args (std::list<int>&), lvar, body(func,gvar,lvar), (int ), 612 Function::run return i argsfront(); 1 lvar 6 12
13 2 (a,b,c), (10,7,23), lvar["a"] = 10; lvar["b"] = 7; lvar["c"] = 23;, lvar args(), i args, 3 x, y, z, lvar["x"] = 0; lvar["y"] = 0; lvar["z"] = 0;, lvar["x"]; lvar["y"]; lvar["z"]; lvar 4 Return t rd = body()->run(func, gvar, lvar); 5, return rdreturn val; 6 Function* function asum = make function asum(); // std::list<int> i arglist; i arglistpush back(3); int r = function asum->run(func, gvar, i arglist); std::cout << r << std::endl; 6 13
14 int asum(int n) { int s; int i; s = 0; i = -n; while(i<=n) { if (i<0) s = s - i; else s = s + i; i = i + 1; return s; n = 3,, 12 OK 7, std::list<expression*> arglist; arglistpush back(new Exp constant(type INT, 5)); Expression* exp function asum = new Exp function("asum", arglist); func["asum"] = make function asum(); int asum5 = exp function asum->run(func, gvar, lvar); std::cout << "asum(5) = " << asum5 <<std::endl; asum(5);, = 30 OK 6213 (Program) Program::run, Program::run, gvar, func, main, 613 Program::run 1 gvar, vars() gvar Function::run 2 func, funcs() func 3 main std::list<int> iargs; int v = main()->run(func, gvar, iargs); return v;
15 // std::list<variable*> gvar; std::list<function*> func; gvarpush back(new Variable(Type INT, "g")); funcpush back(make function asum()); Program* p = new Program(gvar, func, make function main()); // p->run();, make function main, main int main() { int a; g = 3; a = asum(g); putint(a);, factorcpp prog->print(std::cout);, prog->run(); &, asth astcpp, C++,,,,,, Nagisa ISHIURA 6 15
yacc.dvi
2017 c 8 Yacc Mini-C C/C++, yacc, Mini-C, run,, Mini-C 81 Yacc Yacc, 1, 2 ( ), while ::= "while" "(" ")" while yacc 1: st while : lex KW WHILE lex LPAREN expression lex RPAREN statement 2: 3: $$ = new
More informationcpp1.dvi
2017 c 1 C++ (1) C C++, C++, C 11, 12 13 (1) 14 (2) 11 1 n C++ //, [List 11] 1: #include // C 2: 3: int main(void) { 4: std::cout
More informationcpp2.dvi
2018 c 2 C++ (2) STL, C++ 21 string 22 STL 23 21 string C, \0, (, ), (, ), /,,,, C++,,, string string,,,,,, include,,, int, > >>,,,, getline(, string ), [List 21] 2: #include 3: 4:
More informationCondition DAQ condition condition 2 3 XML key value
Condition DAQ condition 2009 6 10 2009 7 2 2009 7 3 2010 8 3 1 2 2 condition 2 3 XML key value 3 4 4 4.1............................. 5 4.2...................... 5 5 6 6 Makefile 7 7 9 7.1 Condition.h.............................
More information1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>
1 C++ 1.1 C C++ C++ C C C++ 1.1.1 C printf() scanf() C++ C hello world printf() 1-1 #include printf( "hello world\n" ); C++ 1-2 std::cout
More informationdouble 2 std::cin, std::cout 1.2 C fopen() fclose() C++ std::fstream 1-3 #include <fstream> std::fstream fout; int a = 123; fout.open( "data.t
C++ 1 C C++ C++ C C C++ 1.1 C printf() scanf() C++ C 1-1 #include int a; scanf( "%d", &a ); printf( "a = %d\n", a ); C++ 1-2 int a; std::cin >> a; std::cout
More informationcpp4.dvi
2017 c 4 C++ (4) C++, 41, 42, 1, 43,, 44 45, 41 (inheritance),, C++,, 100, 50, PCMCIA,,,,,,,,, 42 1 421 ( ), car 1 [List 41] 1: class car { 2: private: 3: std::string m model; // 4: std::string m maker;
More informationr07.dvi
19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1
More informationohp07.dvi
19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5
More information解きながら学ぶJava入門編
44 // class Negative { System.out.print(""); int n = stdin.nextint(); if (n < 0) System.out.println(""); -10 Ÿ 35 Ÿ 0 n if statement if ( ) if i f ( ) if n < 0 < true false true false boolean literalboolean
More information6-1
6-1 (data type) 6-2 6-3 ML, Haskell, Scala Lisp, Prolog (setq x 123) (+ x 456) (setq x "abc") (+ x 456) ; 6-4 ( ) subtype INDEX is INTEGER range -10..10; type DAY is (MON, TUE, WED, THU, FRI, SAT, SUN);
More informationK227 Java 2
1 K227 Java 2 3 4 5 6 Java 7 class Sample1 { public static void main (String args[]) { System.out.println( Java! ); } } 8 > javac Sample1.java 9 10 > java Sample1 Java 11 12 13 http://java.sun.com/j2se/1.5.0/ja/download.html
More informationlexex.dvi
(2018, c ) http://istksckwanseiacjp/ ishiura/cpl/ 4 41 1 mini-c lexc,, 2 testlexc, lexc mini-c 1 ( ) mini-c ( ) (int, char, if, else, while, return 6 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,
More informationA/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B
A/B (2018/10/19) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 10 19 A/B 1 2018 10 19 2 1 1 1.1 OHP.................................... 1
More informationSystemC言語概論
SystemC CPU S/W 2004/01/29 4 SystemC 1 SystemC 2.0.1 CPU S/W 3 ISS SystemC Co-Simulation 2004/01/29 4 SystemC 2 ISS SystemC Co-Simulation GenericCPU_Base ( ) GenericCPU_ISS GenericCPU_Prog GenericCPU_CoSim
More informationC言語によるアルゴリズムとデータ構造
Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",
More informationuntitled
C++2 1. publicprivate 2. 3. 4. 5. Intelligent Electronic Systems Group protected Carmainmy_car.car_number ca_number //Car class Car int car_number; // void showgas( ); // double gas; // void shownumber(
More information( ) ( ) lex LL(1) LL(1)
() () lex LL(1) LL(1) http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 29 5 14 1 1 () / (front end) (back end) (phase) (pass) 1 2 1 () () var left, right; fun int main() { left = 0; right = 10;
More informationuntitled
II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*
More information1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include
1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() malloc 2 #include #include #include enum LENGTH = 10 ; int
More informationprogrammingII2019-v01
II 2019 2Q A 6/11 6/18 6/25 7/2 7/9 7/16 7/23 B 6/12 6/19 6/24 7/3 7/10 7/17 7/24 x = 0 dv(t) dt = g Z t2 t 1 dv(t) dt dt = Z t2 t 1 gdt g v(t 2 ) = v(t 1 ) + g(t 2 t 1 ) v v(t) x g(t 2 t 1 ) t 1 t 2
More information- - http://168iroha.net 018 10 14 i 1 1 1.1.................................................... 1 1.................................................... 7.1................................................
More informationMicrosoft PowerPoint - CproNt02.ppt [互換モード]
第 2 章 C プログラムの書き方 CPro:02-01 概要 C プログラムの構成要素は関数 ( プログラム = 関数の集まり ) 関数は, ヘッダと本体からなる 使用する関数は, プログラムの先頭 ( 厳密には, 使用場所より前 ) で型宣言 ( プロトタイプ宣言 ) する 関数は仮引数を用いることができる ( なくてもよい ) 関数には戻り値がある ( なくてもよい void 型 ) コメント
More informationJava演習(4) -- 変数と型 --
50 20 20 5 (20, 20) O 50 100 150 200 250 300 350 x (reserved 50 100 y 50 20 20 5 (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics; (reserved public class Blocks1 extends
More informationr02.dvi
172 2017.7.16 1 1.1? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X ( ) 1.2 1 2-0 ( ) ( ) ( ) (12) ( ) (112) (131) 281 26 1 (syntax) (semantics) ( ) 2 2.1 BNF BNF(Backus Normal Form) Joun Backus (grammer) English
More informationohp02.dvi
172 2017.7.16 1 ? X A B A X B ( )? IBMPL/I FACOM PL1 ( ) X 2 ( ) 3 2-0 ( ) ( ) ( ) (12) ( ) (112) 31) 281 26 1 4 (syntax) (semantics) ( ) 5 BNF BNF(Backus Normal Form) Joun Backus (grammer) English grammer
More informationr03.dvi
19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---
More informationohp07.dvi
17 7 (2) 2017.9.13 1 BNF BNF ( ) ( ) 0 ( ) + 1 ( ) ( ) [ ] BNF BNF BNF prog ::= ( stat ) stat ::= ident = expr ; read ident ; print expr ; if ( expr ) stat while ( expr ) stat { prog expr ::= term ( +
More information() / (front end) (back end) (phase) (pass) 1 2
1 () () lex http://www.cs.info.mie-u.ac.jp/~toshi/lectures/compiler/ 2018 4 1 () / (front end) (back end) (phase) (pass) 1 2 () () var left, right; fun int main() { left = 0; right = 10; return ((left
More informationdesign_pattern.key
#include void init(int* ary, int size) for (int i = 0; i < size; ++i) ary[i] = i; void mul10(int* ary, int size) for (int i = 0; i < size; ++i) ary[i] *= 10; void dispary(int* ary, int size)
More information1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou
1 1.1 C 2 1 double a[ ][ ]; 1 3x3 0 1 3x3 ( ) 0.240 0.143 0.339 0.191 0.341 0.477 0.412 0.003 0.921 1.2 malloc() 2 double *a[ ]; double 1 malloc() double 1 malloc() free() 3 #include #include
More informationlistings-ext
(6) Python (2) ( ) ohsaki@kwansei.ac.jp 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1
More informationohp03.dvi
19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0
More information明解Javaによるアルゴリズムとデータ構造
21 algorithm List 1-1 a, b, c max Scanner Column 1-1 List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); Chap01/Max3.java
More information# let st1 = {name = "Taro Yamada"; id = };; val st1 : student = {name="taro Yamada"; id=123456} { 1 = 1 ;...; n = n } # let string_of_student {n
II 6 / : 2001 11 21 (OCaml ) 1 (field) name id type # type student = {name : string; id : int};; type student = { name : string; id : int; } student {} type = { 1 : 1 ;...; n : n } { 1 = 1 ;...; n = n
More informationML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1
More Logic More Types ML/OCaml GADT Jacques Garrigue ( ) Jacques Le Normand (Google) Didier Rémy (INRIA) @garriguejej ocamlgadt ML Edinburgh LCF ML Curry-Howard ML ( ) ( ) ( ) ( ) 1 ( ) ML type nebou and
More informationcompiler-text.dvi
2018.4 1 2 2.1 1 1 1 1: 1. (source program) 2. (object code) 3. 1 2.2 C if while return C input() output() fun var ( ) main() C (C-Prime) C A B C 2.3 Pascal P 1 C LDC load constant LOD load STR store AOP
More information( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1
() 2006 2 27 1 10 23 () 30 () 27 [1] p.97252 7 2 2.1 2.1.1 1 LIFO(last in first out, ) (push) (pup) 1 1: 2.1.2 1 List 4-1(p.100) stack[] stack top 1 2 (push) (pop) 1 2 void stack push(double val) val stack
More informationやさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF
pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) pref : 2004/6/5 (11:8) 3 5 14 18 21 23 23 24 28 29 29 31 32 34 35 35 36 38 40 44 44 45 46 49 49 50 pref : 2004/6/5 (11:8) 50 51 52 54 55 56 57 58 59 60 61
More information: : : TSTank 2
Java (8) 2008-05-20 Lesson6 Lesson5 Java 1 Lesson 6: TSTank1, TSTank2, TSTank3 java 2 car1 car2 Car car1 = new Car(); Car car2 = new Car(); car1.setcolor(red); car2.setcolor(blue); car2.changeengine(jet);
More informationJava (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3
Java (7) 2008-05-20 1 Lesson 5 1.1 5 3 = (1) 1 m 3 /s 1 2 3 10 m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3 1.2 java 2 1. 2. 3. 4. 3 2 1.3 i =1, 2, 3 V i (t) 1 t h i (t) i F, k
More informationJacques Garrigue
Jacques Garrigue Garrigue 1 Garrigue 2 $ print_lines () > for i in $1; do > echo $i > done $ print_lines "a b c" a b c Garrigue 3 Emacs Lisp (defun print-lines (lines) (dolist (str lines) (insert str)
More information¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse
I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2
More information10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV
tutimura@mist.i.u-tokyo.ac.jp kaneko@ipl.t.u-tokyo.ac.jp http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 12 11 p.1/33 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20
More informationPL : pl0 ( ) 1 SableCC ( sablecc ) 1.1 sablecc sablecc Étienne Gagnon [1] Java sablecc sablecc ( ) Visitor DepthFirstAdapter 1 (Depth
PL0 2007 : 2007.05.29 pl0 ( ) 1 SableCC ( sablecc ) 1.1 sablecc sablecc Étienne Gagnon [1] Java sablecc sablecc () Visitor DepthFirstAdapter 1 (Depth First traversal) ( ) (breadth first) 2 sablecc 1.2
More information新版明解C言語 実践編
2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,
More informationmstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )
2008 3 10 1 mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( ) stream FILE ( man ) 40 ( ) %./a.out String : test
More informationex01.dvi
,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double
More informationPowerPoint Presentation
p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight
More information3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<
C++ C C++ 1 C++ C++ C C++ C C++? C C++ C *.c *.cpp C cpp VC C++ 2 C++ C++ C++ [1], C++,,1999 [2],,,2001 [3], ( )( ),,2001 [4] B.W. /D.M.,, C,,1989 C Web [5], http://kumei.ne.jp/c_lang/ 3 Hello World Hello
More informationJava Java Java Java Java 4 p * *** ***** *** * Unix p a,b,c,d 100,200,250,500 a*b = a*b+c = a*b+c*d = (a+b)*(c+d) = 225
Java Java Java Java Java 4 p35 4-2 * *** ***** *** * Unix p36 4-3 a,b,c,d 100,200,250,500 a*b = 20000 a*b+c = 20250 a*b+c*d = 145000 (a+b)*(c+d) = 225000 a+b*c+d = 50600 b/a+d/c = 4 p38 4-4 (1) mul = 1
More informationuntitled
II yacc 005 : 1, 1 1 1 %{ int lineno=0; 3 int wordno=0; 4 int charno=0; 5 6 %} 7 8 %% 9 [ \t]+ { charno+=strlen(yytext); } 10 "\n" { lineno++; charno++; } 11 [^ \t\n]+ { wordno++; charno+=strlen(yytext);}
More informationII ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D
II 8 2003 11 12 1 6 ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 Daisuke 8 =>. 73 Daisuke 35 Hiroshi 64 Ichiro 87 Junko
More information新・明解C言語で学ぶアルゴリズムとデータ構造
第 1 章 基本的 1 n 141 1-1 三値 最大値 algorithm List 1-1 a, b, c max /* */ #include int main(void) { int a, b, c; int max; /* */ List 1-1 printf("\n"); printf("a"); scanf("%d", &a); printf("b"); scanf("%d",
More informationclass IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =
Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value
More information新コンフィギュレータのフレームワークについて
: 2007 12 7 6: 2009 5 9 TOPPERS 1.... 4 1.1... 4 1.2 TOPPERS... 4 2.... 4 2.1... 4 3.... 8 4.... 9 4.1... 9 4.2... 10 4.3... 10 4.3.1... 11 4.3.2 INCLUDE... 11 4.3.3 C... 12 4.4 API... 14 4.2.1 API...
More informationI ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b
I 4 003 4 30 1 ASCII ( ) 0 17 0 NUL 16 DLE SP 0 @ P 3 48 64 80 96 11 p 1 SOH 17 DC1! 1 A Q a 33 49 65 81 97 113 q STX 18 DC " B R b 34 50 66 8 98 114 r 3 ETX 19 DC3 # 3 C S c 35 51 67 83 99 115 s 4 EOT
More information明解Java入門編
1 Fig.1-1 4 Fig.1-1 1-1 1 Table 1-1 Ease of Development 1-1 Table 1-1 Java Development Kit 1 Java List 1-1 List 1-1 Chap01/Hello.java // class Hello { Java System.out.println("Java"); System.out.println("");
More information# let rec sigma (f, n) = # if n = 0 then 0 else f n + sigma (f, n-1);; val sigma : (int -> int) * int -> int = <fun> sigma f n ( : * -> * ) sqsum cbsu
II 4 : 2001 11 7 keywords: 1 OCaml OCaml (first-class value) (higher-order function) 1.1 1 2 + 2 2 + + n 2 sqsum 1 3 + 2 3 + + n 3 cbsum # let rec sqsum n = # if n = 0 then 0 else n * n + sqsum (n - 1)
More informationA/B (2018/06/08) Ver kurino/2018/soft/soft.html A/B
A/B (2018/06/08) Ver. 1.0 kurino@math.cst.nihon-u.ac.jp http://edu-gw2.math.cst.nihon-u.ac.jp/ kurino/2018/soft/soft.html 2018 6 8 A/B 1 2018 6 8 2 1 1 1.1 OHP.................................... 1 1.2
More informationr08.dvi
19 8 ( ) 019.4.0 1 1.1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( ) 1 next 1 prev 1 head cur tail head cur prev
More information2017_08_ICN研究会_印刷用
class Producer : noncopyable public: run() m_face.setinterestfilter("/example/testapp", bind(&producer::oninterest, this, _1, _2), RegisterPrefixSuccessCallback(), bind(&producer::onregisterfailed, this,
More informationB's Recorderマニュアル_B's Recorderマニュアル
5 Part 6 - 8 9 - 0 5 A C B AB A B A B C 7-6 - 8 9-5 0 5 7 A D B C E F A B C D F E 6 9 8 0 Part - - 5 5 7 6 9-7 6 8 0 5 5-6 7 9 8 5-5 50 5 5 5 -6 5 55 5 57-7 56 59 8 7 6 58 0 8 9 6 6 7 6 5 60 7 5 6 6-8
More informationB's Recorderマニュアル
2 3 4 5 Part 1 6 1-1 8 9 1-2 10 11 12 13 A B C A C B AB A B 14 15 17 1-4 2 1 16 1-3 18 19 1-5 2 1 20 21 22 23 24 25 A B C D E F A B C D E F 26 27 28 29 30 31 Part 2 32 2-1 2-2 1 2 34 35 5 37 4 3 36 6 2-3
More informationdouble float
2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................
More informationohp08.dvi
19 8 ( ) 2019.4.20 1 (linked list) ( ) next ( 1) (head) (tail) ( ) top head tail head data next 1: 2 (2) NULL nil ( ) NULL ( NULL ) ( 1 ) (double linked list ) ( 2) 3 (3) head cur tail head cur prev data
More informationhaskell.gby
Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]
More information(1/2) 2/45 HPC top runner application programmer PC-9801F N88-BASIC Quick BASIC + DOS ( ) BCB Windows Percolation, Event-driven MD ActionScript Flash
1/45 8 Outline 1. 2. 3. 4. Jun. 6, 2013@ A (1/2) 2/45 HPC top runner application programmer PC-9801F N88-BASIC Quick BASIC + DOS ( ) BCB Windows Percolation, Event-driven MD ActionScript Flash MPI MD (2/2)
More informationMicrosoft Word - C言語研修 C++編 3.doc
2006/05/10 オブジェクト指向... 3 1 クラスの継承... 3 2 継承の書式... 3 3 protected... 5 4 メンバ関数のオーバーライド... 6 5 クラスの型キャスト... 7 6 仮想関数... 8 2 オブジェクト指向 1 クラスの継承 クラスには 継承 という機能があります 継承とは 既にあるクラスを元に 新しいクラスを作る 機能です 継承元のクラスを 親クラス
More information新・明解Javaで学ぶアルゴリズムとデータ構造
第 1 章 基本的 1 n 21 1-1 三値 最大値 algorithm List 1-1 a, b, c max // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); List 1-1 System.out.println("");
More informationclass IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value =
Part2-1-3 Java (*) (*).class Java public static final 1 class IntCell { private int value ; int getvalue() {return value; private IntCell next; IntCell next() {return next; IntCell(int value) {this.value
More informationJava (5) 1 Lesson 3: x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java , 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flow
Java (5) 1 Lesson 3: 2008-05-20 2 x 2 +4x +5 f(x) =x 2 +4x +5 x f(10) x Java 1.1 10 10 0 1.0 2.0, 3.0,..., 10.0, 1.0, 2.0,... flow rate (m**3/s) "flowrate.dat" 10 8 6 4 2 0 0 5 10 15 20 25 time (s) 1 1
More information/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v
1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );
More informationALG ppt
2012 6 21 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 l l O(1) l l l 2 (123 ) l l l l () l H(k) = k mod n (k:, n: ) l l 3 4 public class MyHashtable
More informationmonad.gby
2012.11.18 1 1 2 2 DSL 3 4 Q) A) 5 Q) A) 6 7 8 Haskell 9 10 Parser data Parser a = Parser (String -> [(a,string)]) Parser pwrap :: a -> Parser a pwrap v = Parser $ \inp -> [(v,inp)] Parser pbind :: Parser
More informationII 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y
II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C 1 6 9 1 main main 1 NULL NULL 1 15 23 25 48 26 30 32 36 38 43 45 47 50 52 for 2 (a) 2 2 1 Yacc 2 (b) 2 3 yytext tmp2 ("") tmp2->next->word tmp2 yytext tmp2->next->word
More informationJava (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1
Java (9) 1 Lesson 7 2008-05-20 Java System.out.println() 1 Java API 1 Java Java 1 GUI 2 Java 3 1.1 5 3 1.0 10.0, 1.0, 0.5 5.0, 3.0, 0.3 4.0, 1.0, 0.6 1 2 4 3, ( 2 3 2 1.2 Java (stream) 4 1 a 5 (End of
More informationuntitled
2011 6 20 (sakai.keiichi@kochi-tech.ac.jp) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2011/index.html tech.ac.jp/k1sakai/lecture/alg/2011/index.html html 1 O(1) O(1) 2 (123) () H(k) = k mod n
More informationTopLink å SampleClient.java... 5 Ò readallsample() querysample() cachesample() Ç..
lê~åäé= qçéiáåâ= NMÖENMKNKPF Volume2 Creation Date: Mar 04, 2005 Last Update: Aug 22, 2005 Version 1.0 ...3... 3 TopLink å...4 1... 4... 4 SampleClient.java... 5 Ò... 8... 9... 10 readallsample()... 11
More information2
Haskell ( ) kazu@iij.ad.jp 1 2 Blub Paul Graham http://practical-scheme.net/trans/beating-the-averages-j.html Blub Blub Blub Blub 3 Haskell Sebastian Sylvan http://www.haskell.org/haskellwiki/why_haskell_matters...
More information11夏特集号初校.indd
1 2 3 5 50 40 7 6 3 ABC 3 5 A 5% B C 100 3 1 2 3 A 5% 5% 5% B 10% 5% 0% C 20% 10% 15% A 15.8% 15.0% 0.8% B 15.5% 15.0% 0.5% C 12.2% 15.0% 2.8% 2,000 1,500 1,000 500 0 10% 5% 3% 1% 01 5 10 15 20 25 30
More information8 if switch for while do while 2
(Basic Theory of Information Processing) ( ) if for while break continue 1 8 if switch for while do while 2 8.1 if (p.52) 8.1.1 if 1 if ( ) 2; 3 1 true 2 3 false 2 3 3 8.1.2 if-else (p.54) if ( ) 1; else
More informationFor_Beginners_CAPL.indd
CAPL Vector Japan Co., Ltd. 目次 1 CAPL 03 2 CAPL 03 3 CAPL 03 4 CAPL 04 4.1 CAPL 4.2 CAPL 4.3 07 5 CAPL 08 5.1 CANoe 5.2 CANalyzer 6 CAPL 10 7 CAPL 11 7.1 CAPL 7.2 CAPL 7.3 CAPL 7.4 CAPL 16 7.5 18 8 CAPL
More informationfp.gby
1 1 2 2 3 2 4 5 6 7 8 9 10 11 Haskell 12 13 Haskell 14 15 ( ) 16 ) 30 17 static 18 (IORef) 19 20 OK NG 21 Haskell (+) :: Num a => a -> a -> a sort :: Ord a => [a] -> [a] delete :: Eq a => a -> [a] -> [a]
More information新・明解Java入門
537,... 224,... 224,... 32, 35,... 188, 216, 312 -... 38 -... 38 --... 102 --... 103 -=... 111 -classpath... 379 '... 106, 474!... 57, 97!=... 56 "... 14, 476 %... 38 %=... 111 &... 240, 247 &&... 66,
More information新・明解Javaで学ぶアルゴリズムとデータ構造
第 3 章 探索 Arrays.binarySearch 743 3-1 探索 探索 searching key 配列 探索 Fig.3-1 b c 75 a 6 4 3 2 1 9 8 2 b 64 23 53 65 75 21 3-1 53 c 5 2 1 4 3 7 4 Fig.3-1 a 763 3-2 線形探索 線形探索 linear search sequential search 2
More information226
226 227 Main ClientThread Request Channel WorkerThread Channel startworkers takerequest requestqueue threadpool WorkerThread channel run Request tostring execute name number ClientThread channel random
More informationParametric Polymorphism
ML 2 2011/04/19 Parametric Polymorphism Type Polymorphism ? : val hd_int : int list - > int val hd_bool : bool list - > bool val hd_i_x_b : (int * bool) list - > int * bool etc. let hd_int = function (x
More informationVB.NETコーディング標準
(C) Copyright 2002 Java ( ) VB.NET C# AS-IS extremeprogramming-jp@objectclub.esm.co.jp bata@gold.ocn.ne.jp Copyright (c) 2000,2001 Eiwa System Management, Inc. Object Club Kenji Hiranabe02/09/26 Copyright
More informationprogram.dvi
2001.06.19 1 programming semi ver.1.0 2001.06.19 1 GA SA 2 A 2.1 valuename = value value name = valuename # ; Fig. 1 #-----GA parameter popsize = 200 mutation rate = 0.01 crossover rate = 1.0 generation
More information明解Javaによるアルゴリズムとデータ構造
74 searching 3 key Fig.3-1 75 2を探索 53を探索 3-1 5 2 1 4 3 7 4 を探索 Fig.3-1 76 3 linear searchsequential search 2 Fig.3-2 0 ❶ ❷ ❸ 配列の要素を先頭から順に走査していく 探索すべき値と等しい要素を発見 Fig.3-2 6 4 3 2 3-2Fig.3-3 77 5 Fig.3-3 0
More information新版 明解C++入門編
第 1 章画面 出力 入力 C++ C++ C++ C++ C++ C++ C++ C++ #include using C++ C++ C++ main C++ C++ C++ int double char C++ C++ C++ string C++ C++ C++ 21 1-1 C++ 歴史 C++ C++ 歴史 CC with classes Fig.1-1 C C++ Simula 67
More informationVDM-SL VDM VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web bool
VDM-SL VDM++ 23 6 28 VDM-SL Toolbox VDM++ Toolbox 1 VDM-SL VDM++ Web 2 1 3 1.1............................................... 3 1.1.1 bool......................................... 3 1.1.2 real rat int
More informationとても使いやすい Boost の serialization
とても使いやすい Boost の serialization Zegrahm シリアライズ ( 直列化 ) シリアライズ ( 直列化 ) とは何か? オブジェクトデータをバイト列や XML フォーマットに変換すること もう少しわかりやすく表現すると オブジェクトの状態を表す変数 ( フィールド ) とオブジェクトの種類を表す何らかの識別子をファイル化出来るようなバイト列 XML フォーマット形式で書き出す事を言う
More information橡Pro PDF
1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i
More informationML λ λ 1 λ 1.1 λ λ λ e (λ ) ::= x ( ) λx.e (λ ) e 1 e 2 ( ) ML λx.e Objective Caml fun x -> e x e let 1
2005 sumii@ecei.tohoku.ac.jp 2005 6 24 ML λ λ 1 λ 1.1 λ λ λ e (λ ) ::= x ( ) λx.e (λ ) e 1 e 2 ( ) ML λx.e Objective Caml fun x -> e x e let 1 let λ 1 let x = e1 in e2 (λx.e 2 )e 1 e 1 x e 2 λ 3 λx.(λy.e)
More informationProgram Design (プログラム設計)
7. モジュール化設計 内容 : モジュールの定義モジュールの強度又は結合力モジュール連結モジュールの間の交信 7.1 モジュールの定義 プログラムモジュールとは 次の特徴を持つプログラムの単位である モジュールは 一定の機能を提供する 例えば 入力によって ある出力を出す モジュールは 同じ機能仕様を実装しているほかのモジュールに置き換えられる この変化によって プログラム全体に影響をあまり与えない
More informationex01.dvi
,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double
More informationジョインポイント写像に基づく ドメイン特化AO機構の開発手法
X Aspect Aspect Aspect Aspect Aspect Aspect Aspect Aspect Aspect Aspect Aspect in out in out in out in out in out in in out out in out in out in out in in out out in out in out in out in in out
More information