software for translators barcelona, january 2002

31
Software for Translators Barcelona, January 2002

Upload: marvin-ford

Post on 03-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Software for Translators

Barcelona, January 2002

Content

Programming and Languages Origins 4 Languages

The Programming Cylcle Edit Compile Execute

Exercises: Java Programming

Language Elements

Programming and Languages

The ancient days (1950)

The ancient days (1950)

The ancient days (1950)

The ancient days (1950)

PunchedPaper

A

C

B

D

E F

„Registers“

ld A, 1

1 A

ld B, 2

2 B

add A,B

3 A

The old days (1970)

The old days (1970)

ComputerMemory

A

C

B

D

E F

„Registers“

ProgramCounter

00010203040506070809101112

..

2 B

ld A, 101 PC

1 A

ld B, 202 PC

2 B

add A,B03 PC

3 A

Basic (1980)

Basic (1980)

Basic (1980)

10 set a = 1;20 set b = 2;30 set a = a + b;40 print a;

=> 3

A

C

B

D

E F

2 B3 A

Basic (1980)

10 print 1+2;

=> 3A

C

B

D

E F

2 B3 A

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

4 Languages

Basic Visual Basic Java HTML

Basic Example

10 rem Just print Hello World.20 print ´Hello World´

=> Hello World

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 #iEnd Sub

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

HTML Example

<html> <body> Hello World! </body></html> Text Editor: HTML

Internet Explorer

The Programming Cycle

The Programming Cycle

Edit Execute

Compile

javac HelloWorld.java

java HelloWorld

Edit

Compile

Compile javac HelloWorld.java

Execute

Execute java HelloWorld

<Java Exercise>

Language Elements

Language Elements

Comments // Comment /* Comment */ % Comment

Keywords: FOR NEXT WHILE DOI F

Strings: “Hello World” ´Hello World´ ‘Hello World’

Identifiers: ClassName x, y, z

Parenthesis: (foo bar) [foo bar] {foo bar}

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!"); } }

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!"); } }

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!"); } }

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!"); } }