PL : pl0 ( ) 1 SableCC ( sablecc ) 1.1 sablecc sablecc Étienne Gagnon [1] Java sablecc sablecc ( ) Visitor DepthFirstAdapter 1 (Depth
|
|
|
- あきひろ ながだき
- 6 years ago
- Views:
Transcription
1 PL : 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 sablecc sablecc icho (sablecc-3.2.tar.gz) sablecc sablecc 1
2 (bash : $ ) $ export PATH=$PATH:~nakai/sablecc-3.2/bin icho tar $ cd $ tar zxv ~nakai/sablecc-3.2.tar.gz sablecc-3.2 bin lib bin sablecc java -jar lib/sablecc.jar $* 1 Package postfix; 2 3 Tokens 4 number = [ ]+; 5 plus = + ; 6 minus = - ; 7 mult = * ; 8 div = / ; 9 mod = % ; 10 l_par = ( ; 11 r_par = ) ; 12 blank = ( 13 10)+; Ignored Tokens 15 blank; Productions 18 expr = 19 {factor} factor 20 {plus} expr plus factor 21 {minus} expr minus factor; factor = 24 {term} term 25 {mult} factor mult term 26 {div} factor div term 27 {mod} factor mod term; term = 30 {number} number 30 {expr} l_par expr r_par; java -jar ~/sablecc-3.2/lib/sablecc.jar $* $ chmod a+rx sablecc 1.3 sablecc [1] 1 sablecc ( ) 1 package postfix; Java 2 Tokens = ; [ ] Java uni 1: postfix.grammar 14 Ignored Tokens 17 ( = production rule) sablecc 18 expr 3 { } sablecc (lexer) (parser) (node) (analysis) $ sablecc postfix.grammar 2
3 -- Generating parser for postfix.grammar in /home1/nakai/ip2 org.sablecc.sablecc.parser.parserexception: [4,23] expecting: ] at org.sablecc.sablecc.parser.parser.parse(unknown Source) at org.sablecc.sablecc.sablecc.processgrammar(unknown Source) at org.sablecc.sablecc.sablecc.processgrammar(unknown Source) at org.sablecc.sablecc.sablecc.main(unknown Source) 2: sablecc 1 4 ] sablecc ( ) 2 [4, 23] 4 23 expecting : ] ] * * + 1+2*3 = 1+(2*3) 2 ( 1 ) 2 3 * SableCC 3 3 DepthFirstAdapter 1 (node) (analysis) import 4 number 1 package postfix; 2 import postfix.analysis.*; 3 import postfix.node.*; 4 class Translation extends DepthFirstAdapter 5 { 6 public void casetnumber(tnumber node) 7 {// When we see a number, we print it. 8 System.out.print(node); 9 } 10 public void outaplusexpr(aplusexpr node) 11 {// out of alternative {plus} in Expr, // we print the plus. 12 System.out.print(node.getPlus()); 13 } 14 public void outaminusexpr(aminusexpr node) 15 {// out of alternative {minus} in Expr, // we print the minus. 16 System.out.print(node.getMinus()); 17 } 18 public void outamultfactor(amultfactor node) 19 {// out of alternative {mult} in Factor, // we print the mult. 20 System.out.print(node.getMult()); 21 } 22 public void outadivfactor(adivfactor node) 23 {// out of alternative {div} in Factor, // we print the div. 24 System.out.print(node.getDiv()); 25 } 26 public void outamodfactor(amodfactor node) 27 {// out of alternative {mod} in Factor, // we print the mod. 28 System.out.print(node.getMod()); 29 } 30 } 3: Translation.java sablecc T 10 outaplusexpr 3
4 expr = 19 {factor} factor 20 {plus} expr plus factor 21 {minus} expr minus factor; out sablecc A ( {plus}) ( expr) Visitor expr, plus, factor plus getplus DepthFirstAdaptor (main ) parse Start 18 () Start 20 Visitor 1. sablecc package postfix; 2 import postfix.parser.*; 3 import postfix.lexer.*; 4 import postfix.node.*; 5 import java.io.*; 6 public class Compiler 7 { 8 public static void main(string[] arguments){ 9 try { 10 System.out.println ("Type an arithmetic expression:"); 11 // Create a Parser instance. 12 Parser p = 13 new Parser( 14 new Lexer( 15 new PushbackReader( 16 new InputStreamReader (System.in), 1024))); 17 // Parse the input. 18 Start tree = p.parse(); 19 // Apply the translation. 20 tree.apply(new Translation()); 21 } 22 catch(exception e){ 23 System.out.println(e.getMessage()); 24 } 25 } 26 } 4: Compiler.java 2 PL0 sablecc PL0 2.1 icho ~nakai/ip2/pl0d/pl0d README 1. (LIST.java, SymTable.java) 4
5 2. (Information.java) 3. (Code.java, Code- Gen.java, CodePtr.java, Mnemonic.java) 4. (Main.java) 2.2 PL0 ( ) sablecc PL0 10 icho ~nakai/ip2/pl0d/pl0d.grammar pl0 pl0 icho ~nakai/ip2/pl0d/pl0i_src code.output ( INT, 0, 3 ) ( LIT, 0, 3 ) ( CSP, 0, 1 ) ( OPR, 0, 0 ) code.output pl0i PL0 write 3. ( INT, 0, 3 ) 3 3 n 3+n ( LIT, 0, 3 ) 3 ( CSP, 0, 1 ) write () ( OPR, 0, 0 ) sablecc sablecc ( Visitor ) (Hashtable ) 1 Java public Hashbtable<Node, Information> codetable = new Hashtable<Node, Information>(10001); Node Information ( ) CodePtr, String, int ( ) CodePtr 1 Code Code 1 PL0 3 int CodeGen static PL0 Mnemonic PL0 ( ) PL0 SymTable 5
6 addlist search all search block delete block write write PL0 write 3. (.) write write 1 PL0 f = number write statement {write} write expression expression {e} e f t = {f} f e = {t} t write statement block = declparts statement program = block dot write write 3. f = number Translation.java Translation 1 package pl0d; 2 3 import java.util.*; 4 import pl0d.node.*; 5 import pl0d.analysis.*; 6 import pl0d.*; 7 8 public class Translation extends DepthFirstAdapter 9 { public Hashtable<Node, Information> codetable = new Hashtable<Node, Information>(10001); 12 private SymTable st; 13 private int level = 0; public void debug(string s){ 16 System.out.println(s); 17 } Translation(SymTable st){ 20 this.st = st; 21 } } 5: Translation.java DepthFirstAdapter 11 JDK 5.0 <Node, Information> f = number public void outanumberf(anumberf node) (Number) n PL0 ( LIT, 0, n ) public void outanumberf(anumberf node){ int x = Integer.parseInt(node.getNumber().getText()); CodePtr c = new CodePtr(new Code(CodeGen.O_LIT, 0, x)); Information i = new Information(c); codetable.put(node, i); } 6
7 1 2 f = {number} number number node.getnumber() gettext() ( ) Integer.parseInt x number f t = {f} t 1 public void outaft(aft node){ Information tmp = codetable.get(node.getf()); codetable.put(node, tmp); } ( ) (Information ) e = {t} e expression = {e} e statement = {write} write expression PL0 expression write expression 1. expression (CodePtr ) ( ( LIT, 0, n )) 2. write CodePtr add ( CSP, 0, 1 ) Code outanumberf 3. Information block = declparts statement declparts declparts statement write 3 ( INT, 0, 3 + n ) statement write Information program = block dot block ( OPR, 0, 0 ) ( code.output ) CodePtr void printcode() (CodePtr ) printcode write 3. ( INT, 0, 3 ) 7
8 ( LIT, 0, 3 ) ( CSP, 0, 1 ) ( OPR, 0, 0 ) write 1+2*3 f = {number} number t = {mult} t mult f {div} t div f t f PL0 ( OPR, 0, 4 ) ( OPR, 0, 5 ) PL0 ( OPR, 0, 2 ) ( OPR, 0, 3 ) expression 0 1 (f = {par}...) write statement = {}... statement_list writeln statement = {no} writeln writeln ( CSP, 0, 2 ) statement_list {single} {list} statement_list statement ( statement_list) CodePtr add {} statement_list write 3+4; writeln ; 8
9 end 2 10 PL0 (;) level 1 1 SymTable main declparts, declpart, decl, vardecl idlist 1 block ( INT, 0, 3 ) 3 n idlist = {single} id SymTable search_block search_block LIST null LIST ( ) String name int kind int offset int level params LIST prev 1 addlist public void addlist(string name, int kind, int offset, int level, int fparam){ 1 1. id node.getid().gettext() 2. search_block id_list = {list} id_list = {single} id_list id 1 vardecl decl = {variable} declpart = {decl} 9
10 declpart decl declpart = {no} 1 0 declparts SymTable backpatch 1 1 inablock block ( INT, 0, 3 ) 3 var i, j, k;. ( INT, 0, 6 ) ( OPR, 0, 0 ) read read read SymTable search_all read PL0 ( CSP, 0, 0 ) PL0 ( STO, l, o ) l o search_all CSP STO var i; read i; write i; writeln f = {ident} read PL0 PL0 ( LOD, l, o ) l o LIT 10
11 statement = {ident} PL0 := (STO) 4. var i; i:=1*2; i:=i*4; write i; writeln if while 10 condition ( ) condition = {odd} odd 1 PL0 =, <>, <, >, <=, >= = C ( ) <> 1 1 (expression) [left] [right] getleft(), getright() ( OPR, 0, a ) a a = 8 <> 9 < 10 >= 11 > 12 <= 13 if PL0 if else PL0 0 PL0 if JPC ( ) 0( ) ( JPC, 0, ) statement ( LAB, 0, ) CodeGen static int makelabel() 11
12 var i; read i; if odd i then write i; writeln while if while ( LAB, 0, 0 ) ( JPC, 0, 1 ) statement ( JMP, 0, 0 ) ( LAB, 0, 1 ) JMP PL0 const max = 100; id_assign, id_assign_list, constdecl decl = {constant} id_assign (st.constant) number addlist (LIST params) declpart = {decl} decl = {constant} 0 (f = {ident}) (getparams ) PL0 ( LIT, 0, n ) PL0 2.3 PL0 ( ) decl = {function}, funcdecl, fhead, fid fid fid (fid = id) fhead, param param {id_list} id_list Information val 0 id_list id_list 6 f(a, b, c)
13 a a b b c c f 1 f 2 f 3 f 6: f 6 3 f 1 a 3 b 2 c 1 fhead PL0 (CAL) 1 funcdecl SymTable proc_params fhead proc_params 4. funcdecl fhead block fhead block ( OPR, 0, 0 ) decl = {function} declpart, declparts, block declpart = {no} 0 declpart = {decl} declpart decl 1. declpart decl null ( ) 4. declparts block declparts statement 1. declparts, statement declparts 13
14 declparts INT 3 + n n 7. statement f = {emptypar}, f = {identpar} expressionlist f = {emptypar} id 0 PL0 ( CAL, l, o ) l o return return PL0 3 ( RET, 0, a ) a 1 SymTable searchf int 1 return return PL0 return function f() return 101; write f(); writeln expressionlist expressionlist expressionlist {single} expression 1 {list} expressionlist expression expressionlist +1 PL0 7 ( ) 8 ( ) 9 3 PL0 14
15 function f(n) if n < 1 then return 1; return n * f(n - 1); end; var i; read i; if i>0 then write f(i); writeln end 7: function fib(n) if n = 1 then return 1; if n = 2 then return 2; return fib(n - 1) + fib(n - 2); end; var i; read i; write fib(i); writeln 8: n 3 ( ) function fib(n) if n = 1 then return 1; if n = 2 then return 2; return fib(n - 1) + fib(n - 2); end; var i; var j; read i; j := 1; while j<=i do write fib(j); writeln; j := j+1; end 9: n [1] Étienne Gagnon: SABLECC, AN OBJECT- ORIENTED COMPILER FRAMEWORK, Master s thesis, McGill University, Montreal,
16 Package pl0d; Helpers number = [ ]; tab = 9; cr = 13; lf = 10; Tokens lpar = ( ; rpar = ) ; plus = + ; minus = - ; mult = * ; div = / ; semi = ; ; comma =, ; dot =. ; coleq = := ; eq = = ; neq = <> ; lt = < ; gt = > ; le = <= ; ge = >= ; const = const ; var = var ; function = function ; = ; end = end ; if = if ; then = then ; while = while ; do = do ; return = return ; read = read ; write = write ; writeln = writeln ; odd = odd ; id = [ a.. z ] ([ a.. z ] [ ])*; number = number+; blank = ( tab cr lf)+; Ignored Tokens blank; Productions program = block dot; block = declparts statement; declparts = declpart; declpart = {no} {decl} declpart decl; decl = {constant} constdecl {variable} vardecl {function} funcdecl; constdecl = const id_assign_list semi; id_assign_list = {list} id_assign_list comma id_assign {single} id_assign; id_assign = id eq number; vardecl = var id_list semi; id_list = {list} id_list comma id {single} id; funcdecl = function fhead block semi; fhead = fid lpar param rpar ; fid = id; param = {no} {id_list} id_list; statement = {no} {ident} id coleq expression {} statement_list end {if} if condition then statement {while} while condition do statement {return} return expression {read} read id {write} write expression {writeln} writeln; statement_list = {list} statement_list semi statement {single} statement; condition = {odd} odd expression {eq} [left]:expression eq [right]:expression {neq} [left]:expression neq [right]:expression {lt} [left]:expression lt [right]:expression {gt} [left]:expression gt [right]:expression {le} [left]:expression le [right]:expression {ge} [left]:expression ge [right]:expression; expression = {plus} plus e {minus} minus e {e} e; e = {plus} e plus t {minus} e minus t {t} t; t = {mult} t mult f {div} t div f {f} f; f = {number} number {ident} id {emptypar} id lpar rpar {identpar} id lpar expressionlist rpar {par} lpar expression rpar; expressionlist = {list} expressionlist comma expression {single} expression; 10: pl0d.grammar 16
untitled
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] { /*
compiler-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
Java (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
新・明解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,
K227 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
アルゴリズムとデータ構造1
1 200972 (sakai.keiichi@kochi [email protected]) http://www.info.kochi ://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2009/index.html 29 20 32 14 24 30 48 7 19 21 31 Object public class
. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr
Eclipse 1,a) 1,b) 1,c) ( IDE) IDE Graphical User Interface( GUI) GUI GUI IDE View Eclipse Development of Eclipse Plug-in to present an Object Diagram to Debug Environment Kubota Yoshihiko 1,a) Yamazaki
r1.dvi
2006 1 2006.10.6 ( 2 ( ) 1 2 1.5 3 ( ) Ruby Java Java Java ( Web Web http://lecture.ecc.u-tokyo.ac.jp/~kuno/is06/ / ( / @@@ ( 3 ) @@@ : ( ) @@@ (Q&A) ( ) 1 http://www.sodan.ecc.u-tokyo.ac.jp/cgi-bin/qbbs/view.cgi
Microsoft Word - keisankigairon.ch doc
1000000100001010 1000001000001011 0100001100010010 1010001100001100 load %r1,10 load %r2,11 add %r3,%r1,%r2 store %r3,12 k = i + j ; = > (* 1 2 3 4 5 6 7 8 9 10) 3628800 DO 3 I=1,3 DO3I=1.3 DO3I 1.3
1.ppt
/* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)
ex01.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
I java A
I java 065762A 19.6.22 19.6.22 19.6.22 1 1 Level 1 3 1.1 Kouza....................................... 3 1.2 Kouza....................................... 4 1.3..........................................
Java演習(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
syspro-0405.ppt
3 4, 5 1 UNIX csh 2.1 bash X Window 2 grep l POSIX * more POSIX 3 UNIX. 4 first.sh #!bin/sh #first.sh #This file looks through all the files in the current #directory for the string yamada, and then prints
r02.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
: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp
7 OCaml () 1. 2. () (compiler) (interpreter) 2 OCaml (syntax) (BNF,backus normal form ) 1 + 2; let x be 2-1 in x; ::= ; let be in ; ::= + - ::= * / ::= 7.1 ( (printable characters) (tokens) 1 (lexical
untitled
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);}
10/ / /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
[email protected] [email protected] 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
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
3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");
(Basic Theory of Information Processing) Java (eclipse ) Hello World! eclipse Java 1 3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello
haskell.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]
ex01.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
コーディング基準.PDF
Java Java Java Java.java.class 1 private public package import / //////////////////////////////////////////////////////////////////////////////// // // // // ////////////////////////////////////////////////////////////////////////////////
文字列操作と正規表現
文字列操作と正規表現 オブジェクト指向プログラミング特論 2018 年度只木進一 : 工学系研究科 2 文字列と文字列クラス 0 個以上の長さの文字の列 Java では String クラス 操作 文字列を作る 連結する 文字列中に文字列を探す 文字列中の文字列を置き換える 部分文字列を得る 3 String クラス 文字列を保持するクラス 文字列は定数であることに注意 比較に注意 == : オブジェクトとしての同等性
明解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
: : : 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);
解きながら学ぶ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
やさしい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
Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac
Actual4Test http://www.actual4test.com Actual4test - actual test exam dumps-pass for IT exams Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN
ALG ppt
2012614 ([email protected]) http://www.info.kochi-tech.ac.jp/k1sakai/lecture/alg/2012/index.html 1 2 2 3 29 20 32 14 24 30 48 7 19 21 31 4 N O(log N) 29 O(N) 20 32 14 24 30 48 7 19 21 31 5
明解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("");
# 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
導入基礎演習.ppt
Multi-paradigm Programming Functional Programming Scheme Haskell ML Scala X10 KL1 Prolog Declarative Lang. C Procedural Lang. Java C++ Python Object-oriented Programming / (root) bin home lib 08 09
明解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
parser.y 3. node.rb 4. CD-ROM
1. 1 51 2. parser.y 3. node.rb 4. CD-ROM 1 10 2 i 0 i 10 " i i+1 3 for(i = 0; i
CX-Checker CX-Checker (1)XPath (2)DOM (3) 3 XPath CX-Checker. MISRA-C 62%(79/127) SQMlint 76%(13/17) XPath CX-Checker 3. CX-Checker 4., MISRA-C CX- Ch
CX-Checker: C 1 1 2 3 4 5 1 CX-Checker CX-Checker XPath DOM 3 CX-Checker MISRA-C CX-Checker: A Customizable Coding Checker for C TOSHINORI OSUKA, 1 TAKASHI KOBAYASHI, 1 JUNICHI MASE, 2 NORITOSHI ATSUMI,
lexex.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 ) ( ) (+, -, *, /, %, &, =, ==,!=, >, >=,
class 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
Java updated
Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................
class 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
fp.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]
新・明解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("");
2: 3: A, f, φ f(t = A sin(2πft + φ = A sin(ωt + φ ω 2πf 440Hz A ( ( 4 ( 5 f(t = sin(2πf 1t + sin(2πf 2 t = 2 sin(2πt(f 1 + f 2 /2 cos(2πt(f 1 f
12 ( TV TV, CATV, CS CD, DAT, DV, DVD ( 12.1 12.1.1 1 1: T (sec f (Hz T= 1 f P a = N/m 2 1.013 10 5 P a 1 10 5 1.00001 0.99999 2,3 1 2: 3: 12.1.2 A, f, φ f(t = A sin(2πft + φ = A sin(ωt + φ ω 2πf 440Hz
新・明解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
新・明解Java入門
第 1 章 画面 文字 表示 Java Java Java Java Java JRE Java JDK 21 1-1 Java Java Java Java 誕生 Fig.1-1 Oak Java Sun Microsystems 2010 Oracle Java Oracle 4 Java http://www.java.com/ http://www.alice.org/ Fig.1-1Java
グラフの探索 JAVA での実装
グラフの探索 JAVA での実装 二つの探索手法 深さ優先探索 :DFS (Depth-First Search) 幅優先探索 :BFS (Breadth-First Search) 共通部分 元のグラフを指定して 極大木を得る 探索アルゴリズムの利用の観点から 利用する側からみると 取り替えられる部品 どちらの方法が良いかはグラフに依存 操作性が同じでなければ 共通のクラスの派生で作ると便利 共通化を考える
オブジェクト脳のつくり方
2003 12 16 ( ) ML Java,.NET, UML J2EE, Web Java, J2EE.NET SI ex. ) OO OO OO OO OO (Controller) (Promoter) (Analyzer) (Supporter) http://nba.nikkeibp.co.jp/coachsp.html It takes time. OO OK OO 1.
55 7 Java C Java TCP/IP TCP/IP TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] a
55 7 Java C Java TCP/IP TCP/IP 7.1 7.1.1 TCP TCP_RO.java import java.net.*; import java.io.*; public class TCP_RO { public static void main(string[] argv) { Socket readsocket = new Socket(argv[0], Integer.parseInt(argv[1]));
ストラドプロシージャの呼び出し方
Release10.5 Oracle DataServer Informix MS SQL NXJ SQL JDBC Java JDBC NXJ : NXJ JDBC / NXJ EXEC SQL [USING CONNECTION ] CALL [.][.] ([])
22 200702894 1 1 3 2 4 2.1..................................... 4 2.1.1............................. 4 2.1.2............................. 4 2.2................................... 9 2.2.1...................................
Oracle Forms Services R6i
Creation Date: Jul 04, 2001 Last Update: Jul 31, 2001 Version: 1.0 0 0... 1 1...3 1.1... 3 1.2... 3 1.3... 3 2...4 2.1 C/S... 4 2.2 WEB... 5 2.3 WEB... 5 2.4 JAVABEAN... 6 3 JAVABEAN...7 3.1... 7 3.2 JDEVELOPER...
5 p Point int Java p Point Point p; p = new Point(); Point instance, p Point int 2 Point Point p = new Point(); p.x = 1; p.y = 2;
5 p.1 5 JPanel (toy example) 5.1 2 extends : Object java.lang.object extends... extends Object Point.java 1 public class Point { // public int x; public int y; Point x y 5.1.1, 5 p.2 5 5.2 Point int Java
JavaScript の使い方
JavaScript Release10.5 JavaScript NXJ JavaScript JavaScript JavaScript 2 JavaScript JavaScript JavaScript NXJ JavaScript 1: JavaScript 2: JavaScript 3: JavaScript 4: 1 1: JavaScript JavaScript NXJ Static
(Eclipse\202\305\212w\202\324Java2\215\374.pdf)
C H A P T E R 11 11-1 1 Sample9_4 package sample.sample11; public class Sample9_4 { 2 public static void main(string[] args) { int[] points = new int[30]; initializearray(points); double averagepoint =
{:from => Java, :to => Ruby } Java Ruby KAKUTANI Shintaro; Eiwa System Management, Inc.; a strong Ruby proponent http://kakutani.com http://www.amazon.co.jp/o/asin/4873113202/kakutani-22 http://www.amazon.co.jp/o/asin/477413256x/kakutani-22
1. A0 A B A0 A : A1,...,A5 B : B1,...,B12 2. 5 3. 4. 5. A0 (1) A, B A B f K K A ϕ 1, ϕ 2 f ϕ 1 = f ϕ 2 ϕ 1 = ϕ 2 (2) N A 1, A 2, A 3,... N A n X N n X N, A n N n=1 1 A1 d (d 2) A (, k A k = O), A O. f
226
226 227 Main ClientThread Request Channel WorkerThread Channel startworkers takerequest requestqueue threadpool WorkerThread channel run Request tostring execute name number ClientThread channel random
8 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
program.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
r3.dvi
2012 3 / Lisp(2) 2012.4.19 1 Lisp 1.1 Lisp Lisp (1) (setq) (2) (3) setq defun (defun (... &aux...)...) ( ) ( nil ) [1]> (defun sisoku (x y &aux wa sa sho seki) (setq wa (+ x y)) (setq sa (- x y)) (setq
r07.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
