Programming Languages at a Glance Programming Languages at a Glance Published 2003 Copyright © 2003 by Andreas Hohmann Table of Contents 1
Total Page:16
File Type:pdf, Size:1020Kb
Programming Languages at a Glance Programming Languages at a Glance Published 2003 Copyright © 2003 by Andreas Hohmann Table of Contents 1. Introduction............................................................................................................................................1 1.1. Acknowledgements .....................................................................................................................2 2. Fortran....................................................................................................................................................3 2.1. Software and Installation.............................................................................................................3 2.2. Quick Tour ..................................................................................................................................3 2.2.1. Hello World ....................................................................................................................3 2.2.2. Expressions and Variables ..............................................................................................4 2.2.3. Arrays .............................................................................................................................6 2.2.4. Functions ........................................................................................................................6 Bibliography.......................................................................................................................................6 3. Common Lisp.........................................................................................................................................8 3.1. Software and Installation.............................................................................................................8 3.2. Quick Tour ..................................................................................................................................8 3.2.1. Lists and Expressions .....................................................................................................8 3.2.2. Functions ......................................................................................................................13 3.2.3. More Collections ..........................................................................................................16 3.2.4. Structures......................................................................................................................18 3.2.5. Input and Output...........................................................................................................19 3.3. More Features ...........................................................................................................................21 3.3.1. Object Oriented Programming .....................................................................................21 3.3.2. Macros ..........................................................................................................................23 3.3.3. Exceptions ....................................................................................................................24 3.3.4. Analysis Functions .......................................................................................................25 References........................................................................................................................................25 4. Cobol .....................................................................................................................................................27 4.1. Software and Installation...........................................................................................................27 4.2. Quick Tour ................................................................................................................................27 4.2.1. Hello World ..................................................................................................................27 4.2.2. Variables and Arithmetic ..............................................................................................28 4.2.3. Subroutines and Control Statements ............................................................................31 4.2.4. Data Structures .............................................................................................................35 4.2.5. Files and Records .........................................................................................................37 4.3. More Features ...........................................................................................................................38 4.3.1. Table Search .................................................................................................................38 4.3.2. Macros (Copy Books)...................................................................................................40 4.3.3. Subprograms.................................................................................................................41 4.3.4. Sort and Merge .............................................................................................................42 4.3.5. Screen Definitions ........................................................................................................46 4.4. Libraries and Common Examples.............................................................................................47 Bibliography.....................................................................................................................................47 iii 5. C ............................................................................................................................................................48 5.1. Software and Installation...........................................................................................................48 5.2. Quick Tour ................................................................................................................................48 5.2.1. Hello World ..................................................................................................................48 5.2.2. Control Flow.................................................................................................................50 5.2.3. Basic Types...................................................................................................................51 5.2.4. Structures and Type Definitions ...................................................................................55 5.2.5. Functions ......................................................................................................................56 5.2.6. Macros ..........................................................................................................................60 References........................................................................................................................................62 6. Smalltalk...............................................................................................................................................63 6.1. Software and Installation...........................................................................................................63 6.2. Quick Tour ................................................................................................................................63 6.2.1. Message Passing...........................................................................................................63 6.2.2. Collections....................................................................................................................66 6.2.3. Objects and Classes ......................................................................................................69 6.3. More Features ...........................................................................................................................71 6.3.1. An Object-Oriented Example.......................................................................................71 References........................................................................................................................................74 7. Prolog ....................................................................................................................................................75 7.1. Software and Installation...........................................................................................................75 7.2. Quick Tour ................................................................................................................................75 7.2.1. Goals, Facts, and Rules ................................................................................................75 7.2.2. Structures......................................................................................................................78 7.2.3. Collections....................................................................................................................79 7.2.4. Arithmetic.....................................................................................................................81 7.3. More Features ...........................................................................................................................82 7.3.1. Controlling Backtracking .............................................................................................82