Download presentation
Presentation is loading. Please wait.
1
Software for Translators Barcelona, January 2002
2
Content Programming and Languages Origins 4 Languages The Programming Cylcle Edit Compile Execute Exercises: Java Programming Language Elements
3
Programming and Languages
4
The ancient days (1950)
7
Punched Paper A C B D EF „Registers“ ld A, 1 1 A ld B, 2 2 B add A,B 3 A
8
The old days (1970)
9
Computer Memory A C B D EF „Registers“ Program Counter 00 01 02 03 04 05 06 07 08 09 10 11 12.. 2 B ld A, 1 01 PC 1 A ld B, 202 PC 2 B add A,B 03 PC 3 A
10
Basic (1980)
12
10set a = 1; 20set b = 2; 30set a = a + b; 40print a; => 3 A C B D EF 2 B3 A
13
Basic (1980) print 1+2; => 3 A C B D EF 2 B3 A
14
Programming Languages Historic PL/1 Cobol Fortran Basic Object Oriented Smalltalk C C++ Java Python Exotic Prolog Lisp Scripting Shell Perl TCL Database SQL dBase
15
4 Languages Basic Visual Basic Java HTML
16
Basic Example 10 rem Just print Hello World. 20 print ´Hello World´ => Hello World
17
Visual Basic Example '############################################### '# # # # '# # This program places a text into a # # '# # a text box for viewing. # # '# # # # '############################################### Dim i As Integer Private Sub Command1_Click() On Error Resume Next CommonDialog1.ShowOpen i = FreeFile Open CommonDialog1.filename For Input As #i Text1.Text = Input(LOF(i), i) Close #i End Sub
18
Java Example // This example is from Java in a Nutshell. // Copyright (c) 1997 by David Flanagan public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); } => Hello World
19
HTML Example Hello World! Text Editor: HTML Internet Explorer
20
The Programming Cycle
21
EditExecute Compile javac HelloWorld.java java HelloWorld
22
Edit
23
Compile javac HelloWorld.java
24
Execute java HelloWorld
26
Language Elements
27
Comments // Comment /* Comment */ % Comment Keywords: FOR NEXT WHILE DO I F Strings: “Hello World” ´Hello World´ ‘Hello World’ Identifiers: ClassName x, y, z Parenthesis: (foo bar) [foo bar] {foo bar}
28
Comments // This example is from Java in a Nutshell. // Copyright (c) 1997 by David Flanagan public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); }
29
Keywords // This example is from Java in a Nutshell. // Copyright (c) 1997 by David Flanagan public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); }
30
Strings // This example is from Java in a Nutshell. // Copyright (c) 1997 by David Flanagan public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); }
31
Identifiers // This example is from Java in a Nutshell. // Copyright (c) 1997 by David Flanagan public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); }
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.