The New C Standard (Excerpted material)

Size: px
Start display at page:

Download "The New C Standard (Excerpted material)"

Transcription

1 The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright Derek M. Jones. All rights reserved.

2 1854 preprocessor directives syntax preprocessing-file: group opt group: group-part group group-part group-part: if-section control-line text-line # non-directive if-section: if-group elif-groups opt else-group opt endif-line if-group: # if constant-expression new-line group opt # ifdef identifier new-line group opt # ifndef identifier new-line group opt elif-groups: elif-group elif-groups elif-group elif-group: # elif constant-expression new-line group opt else-group: # else new-line group opt endif-line: # endif new-line control-line: # include pp-tokens new-line # define identifier replacement-list new-line # define identifier lparen identifier-list opt ) replacement-list new-line # define identifier lparen... ) replacement-list new-line # define identifier lparen identifier-list,... ) replacement-list new-line # undef identifier new-line # line pp-tokens new-line # error pp-tokens opt new-line # pragma pp-tokens opt new-line # new-line text-line: pp-tokens opt new-line non-directive: pp-tokens new-line lparen: a ( character not immediately preceded by white-space replacement-list: pp-tokens opt pp-tokens: preprocessing-token pp-tokens preprocessing-token new-line: the new-line character v 1.1 January 30, 2008

3 1854 It can be seen from the grammar that most terminals do not match any syntax rules in the other parts of the language. The C language essentially contains two independent languages within it. The preprocessor and what might be called the C language proper. A text-line is the sequence of pp-tokens that are scanned for macros to substitute and subsequently processed by the C language syntax. C90 Support for the following syntax is new in C99: group-part: # non-directive control-line: # define identifier lparen... ) replacement-list new-line # define identifier lparen identifier-list,... ) replacement-list new-line The left hand side terms text-line and non-directive were introduced in C99. Their right-hand side occurred directly in the right-hand side of group-part in the C90 Standard. text-line: pp-tokens opt new-line non-directive: pp-tokens new-line The definition of lparen in C90 was: lparen: the left-parentheses character without preceding white-space The Standard specifies the same syntax as the C90 Standard (16p1). Other Languages While most assembly languages support some form of preprocessor, few high-level languages include one (Lisp, PL/1 do). [3] A conditional compilation mechanism was recently added to the Fortran Standard [6] (it is specifically aimed at conditional compilation and does not offer macro processing functionality). While many versions of Unix include a preprocessor that is independent of the C preprocessor (i.e., m4 [10] ) it has never achieved wide usage (this reason was given for its exclusion from the POSIX Standard). A few other stand-alone preprocessors (often called macro processors) have also been written (e.g., ML/I [2] ). Some non-c preprocessors use the character $ or % rather than #. Common Implementations Because of the relative simplicity of the preprocessor grammar most implementations do not use a tabledriven parser approach, but rather process the directives on an ad hoc basis. Some preprocessors operate at a [5, 11] higher level than individual tokens e.g., taking syntax into account. The base document did not support the preprocessing directive #elif or defined. Support for this functionality was added during the early evolution of C. [8] Also early implementations supported trailing tokens on the same line as preprocessing directives #endif MACRO_NAME and some implementations [9] continue to provide an option to support this functionality. Some early translators did not permit white-space between # and define Some also required the # to be the first character on the line gcc supported... in macro definitions prior to C99. The syntax used was to give the varying arguments a (developer chosen) name, for instance in: January 30, 2008 v 1.1 3

4 #define debug(file, format, args...) fprintf(file, format, args) following the parameter args with... specifies that it takes a variable number of arguments. These variable arguments are substituted wherever the named parameter appears in the replacement list (just like other parameters). The Unix System V C compiler [10] (plus gcc and others) supports the creation and use of what it calls assertions. For instance, (the # before an identifier signaling its status as a predicate): 1 /* #assert predicate(token-sequence) */ 2 3 #assert derek (is_male) /* Associate the answer is_male with the predicate derek. */ 4 5 /* #if #predicate(token-sequence) */ 6 7 #if #derek(is_female) /* Evaluates to false. */ 8 #endif 9 /* 10 * Implementations supporting these kinds of assertions usually 11 * define the predicates system (with answers such as svr4, mach, posix, 12 * hpux, etc.), and cpu (with answers such as i386, sparc, m68k, etc.). 13 */ 14 #if #cpu(sparc) 15 /*... */ 16 #elif #cpu(i386) 17 /*... */ 18 #endif The directive: 1 #ident "version X.Y" is used by a number of translators to include version control information in the source code that is also written out to the generated object file. A common technique is to use a sequence of characters, within the string literal, that are recognized by a source code control system (and which can be updated when a new version is checked in) The matching directives #version/#endversion are available in a Bell-Labs translator. It is claimed [1] that developers were 40% more productive when using a version sensitive editor on a multi million line project having many versions (developed over two decades by more than 5,000 developers). The Plan 9 C compiler intentionally lacks support for the #if directive. [7] Coding Guidelines While lines containing non-preprocessing directives are often visually indented (see Figure ) developers do not generally indent preprocessing directives (see Figure ). One possible reason for this difference is that indentation of preprocessing directives may not provide a visual edge for readers to run their eyes along (e.g., the visible source between conditional inclusion directives may be statements from the C language whose indentation is driven by factors unrelated to preprocessing; that is there are two indentation schemes operating over the same section of source). In over 90% of preprocessing directives the # character appears at the start of the line. Given that preprocessing directives are usually scattered throughout the source this indentation strategy allows them to generally standout from the surrounding statements. In general both the #include and #define directives appear at the start of a source file (see Figure ). By their nature the #if directives are localized at the point when a conditional decision needs to be made. 4 v 1.1 January 30, 2008

5 ,000.c files.h files Visible lines 10,000 1, Indentation of # Figure : Number of lines containing a preprocessing directive starting at a given indentation from the start of the line (i.e., amount of white space before the first # on a line, with the tab character treated as eight space characters). Based on the visible form of.c and.h files. Occurrences 10,000 1, #define #include Percentage line count into.c source file Percentage line count into.h source file Figure : Number of #include and #define directives appearing at a relative location (i.e., 100*line_number/lines_in_file) in the source. Based on the visible form of.c and.h files. Usage A study by Ernst, Badros, and Notkin [4] provides one of the few empirical studies of C preprocessor use. Table : Occurrence of preprocessor directive names and preprocessor operators (as a percentage of all directive names and operators). Based on the visible form of the.c and.h files. Directive Name.c file.h file Directive Name.c file.h file #define #if #endif ## #include #elif #ifndef #pragma #ifdef #error #else # defined #line #undef Description 1855 A preprocessing directive preprocessingdirective consists of a sequence of preprocessing tokens that begins preprocessing directive with satisfies the following constraints: consists of January 30, 2008 v 1.1

6 1858 This defines the term preprocessing directive. Preprocessor directives are line oriented (the second half of the above sentence requires directive to start on a line and finish on the same line). The wording was changed and the sentence split up by the response to DR #303. The first token in the sequence is a # preprocessing token that (at the start of translation phase 4) is either the first character in the source file (optionally after white space containing no new-line characters) or that follows white space containing at least one new-line character,. line splicing It is only after preprocessing that the C language becomes is free format. Line splicing occurs prior to translation phase 4 and was created to enable preprocessor directives to span more than one physical source translation phase line. Because preprocessing directives are identified at the start of translation phase 4 translators do not 4 expanded treat the output from macro expansion (which occurs during translation phase 4) as possible preprocessing token sequence directives (or handle other unusual token sequences as preprocessing directive). not treated as a directive The wording was changed, and this sentence formed, by the response to DR #303. EXAMPLE EMPTY # 1868 C90 The C90 Standard did not contain the words (at the start of translation phase 4), which were added by the response to DR #144. Like C90, the Standard does not specify the start of translation phase 4. and is ended by the next The last token in the sequence is the first new-line character that follows the first token in the sequence. 140) The wording was changed, and this sentence formed, by the response to DR # preprocessing directive ended by macro invocation ) terminates it translation phase 3 A new-line character ends the preprocessing directive even if it occurs within what would otherwise be an invocation of a function-like macro. In the following: 1 #define M_1(a, b) ((a) + (b)) 2 #if M_1(1, /* Syntax violation. */ 3 2) == 3 /* Different logical line unconnected with the previous one. */ 4 #endif 5 6 void f(void) 7 { 8 int loc = M_1(1, 9 2); /* No end-of-line syntax requirements here. */ 10 } the #if preprocessing directive visually spans more than one line. The fact that the macro invocation M_1 is split across two physical lines does not alter the requirements on this preprocessing directive (and a translator required to generate a diagnostic). However, the following example is a rather unusual case: 1 #define M_1(a, b) ((a) + (b)) 2 #if M_1(1, /* Comment about the first argument. 3 Comment about the second argument */ 2) == 3 4 #endif in that the comment is replaced by one space character and the new-line character seen by translation phase 4 is the one that occurs after the preprocessing token 3 (i.e., the code is conforming) v 1.1 January 30, 2008

7 1863 C90 This wording was not in the C90 Standard, and was added by the response to DR #017. Like the original C90 Standard, the Standard does not explicitly specify this behavior. However, given that vendors are likely to use a preprocessor that is identical to the one used in their C product (or the one that used to be used, if they nolonger market a C product), it is unlikely that the behaviors seen in practice will be different ) Thus, preprocessing directives are commonly called lines. footnote 140 The common developer usage is for the term lines to refer to any sequence of characters terminated by a new-line, i.e., the use is not specific, in the developer community, to preprocessing directives. Coding Guidelines Developers are aware of the line-oriented nature of preprocessing directives. However, no terminology (other than preprocessing directive, or simply directive) is commonly used These lines have no other syntactic significance, as all white space is equivalent except in certain situations during preprocessing (see the # character string literal creation operator in , for example). All source file lines are processed during translation phase 4, either as directives or as token sequences to examine for possible macro replacement. However, the preprocessing directive lines are deleted at the end of translation phase 4 and play no further role in translation A text line shall not begin with a # preprocessing token. This is a requirement on the implementation. Syntactically a text-line can start with a # (which is a preprocessing token). This requirement disambiguates the syntax by specifying that such an interpretation shall not be made by the implementation. preprocessing directives deleted 1862 A non-directive shall not begin with any of the directive names appearing in the syntax. This is a requirement on the implementation. Syntactically any sequence of pp-tokens following a # preprocessing token can be a non-directive. This requirement disambiguates the syntax by specifying that such an interpretation (if one exists for the given sequence of preprocessing tokens) shall not be made by the implementation where there is another interpretation. C90 Explicit support for non-directive is new in C99. Explicit support for non-directive is new in C99 and is not discussed in the Standard When in a group that is skipped (6.10.1), the directive syntax is relaxed to allow any sequence of preprocessing tokens to occur between the directive name and the following new-line character. This C sentence introduces the term directive name to describe the preprocessing tokens that occur immediately after the # punctuator (they can be given the status of keywords). footnote 141 January 30, 2008 v 1.1

8 1865 footnote The Committee recognized that the source code contained within a skipped group might still be under 69 development (which is one reason for it being skipped). Given that comments do not nest, it may not be possible, or desirable, to use a comment to prevent translators analyzing the sequence of characters in detail. directive processing while skipping This relaxation of the syntax allows conditional inclusion directive to be used to bracket a sequence of lines that do not yet form a conforming sequence of pp-tokens. 1 #if WORKING_ON_IT 2 3 #if don t know what condition to put here yet 4 #endif 5 6 #endif The directive name needs to be processed to handle any nested conditional preprocessing directives. C90 The C90 Standard did not explicitly specify this behavior. Like C90, the Standard does not explicitly specify this behavior. Common Implementations Many implementations attempt to process skipped groups as quickly as possible. By default, many implementors only examine the minimum number of preprocessing tokens necessary to work out where the skipped group ends. Constraints white-space The only white-space characters that shall appear between preprocessing tokens within a preprocessing within preprocessing directive directive (from just after the introducing # preprocessing token through just before the terminating new-line character) are space and horizontal-tab (including spaces that have replaced comments or possibly other white-space characters in translation phase 3). white-space characters white-space sequence replaced by one macro object-like The use of other white-space characters, (i.e., vertical-tab or form-feed) within preprocessing directives could cause the visual appearance of the source code to suggest that directives are terminated by new-line when in fact they are not. That is the source would be visually confusing and such usage has no obvious benefit. These white-space characters may still appear within preprocessing tokens, e.g., in a character string literal. It is implementation-defined whether other white-space characters are replaced by one space character in translation phase 3. Common Implementations Some implementations support the appearance of a carriage return character immediately prior to the end of line (when that character is not part of the end of line sequence). This enables them to handle text files written using the MS-DOS end of line conventions (i.e., end of line is represented by the two characters \r\n). Coding Guidelines The presence of white-space within a preprocessing directive may or may not be significant. It is sometimes needed (and invariably appears, whether needed or not) to separate the definition of an object-like macro identifier from its body. For instance, in: #define A (x) 2 #define B-y without the intervening white-space the first definition would be for a function-like macro taking a parameter x. No white-space is used in the second definition, but the source would probably be easier to process if some were used. Semantics v 1.1 January 30, 2008

9 The implementation can process and skip sections of source files conditionally, include other source files, and replace macros. Preprocessing directives (e.g., #pragma) can also affect how other phases of translation behave. These #pragma directive translation phase operations are performed during translation phase four. 4 Coding Guidelines It is possible to completely change the meaning of some C constructs, compared to the behavior that would be deduced purely from their visual appearance in the source code. Constructs can be added, deleted, and modified. All without any indication that these operations will occur, in the source code (or at least the.c files). While various criticisms are made about the behavior of the preprocessor (e.g., it performs no semantic checks on the substitutions it makes) the actual problem lies with the people who use it. The preprocessor might be likened to a sharp knife (some people might say a large hammer), being sharp makes the job of cutting easy but don t complain if sloppy use results in the user being cut (or objects near to the hammer being crushed through poor aiming). In some cases it is possible to provide guideline recommendations that prevent problems occurring, in other cases complexity is intrinsic to the problem being handled. For instance, the heavy use of #if/#endif may be the result of having a successful product that runs in many different environments. While some coding guideline documents recommend that preprocessor usage be minimized, such recommendations are really a design issue and as such are outside the scope of these coding guidelines These capabilities are called preprocessing, because conceptually they occur before translation of the resulting preprocessing translation unit. This defines the term preprocessing (the term macro processing is sometimes used by developers, perhaps because macro substitution is felt to have the largest impact on the visible form of the source). This is also a generally used term within software engineering that refers to any set of operations that are performed on the input prior to what are considered to be the main operations (in C s case the subsequent phases of translation). Any later operations are sometimes referred to as post processing. The component of the translator that performs these operations (independent of whether it is a stand alone program or an integrated part of a larger program) is universally known as the preprocessor. The output from preprocessing is a translation unit. The C preprocessor is sometimes used to provide macro processing and conditional compilation in non-c language contexts (e.g., other languages and text processing tasks). Members of the C committee have at times born this usage in mind when considering how the preprocessor should behave. Common Implementations In many implementations preprocessing is carried out by a stand-alone program, usually known as the preprocessor. Coding Guidelines Developers often think of the output of translation stage four as being the output from the preprocessor. In fact the preprocessor is really only translation phase 4, phases 1 3 would need to be performed even if C did not include a preprocessor (the operations these phases perform are performed by languages that do not include a preprocessor). Many guideline recommendations are driven by how developers visually process source code. The recommendations that involve preprocessor constructs are often made because the processing that occurs (e.g., macro expansion) is not directly visible to readers of the source. translation unit known as footnote 5 January 30, 2008 v 1.1

10 1868 tokens in directive not expanded unless #if macros expanded #include macros expanded #line macros expanded footnote 146 The preprocessing tokens within a preprocessing directive are not subject to macro expansion unless otherwise stated. Requiring that macro expansion unconditionally occur within preprocessing directives is not necessarily a desirable requirement (it would also be a change to existing translator behavior that could break existing code). Most preprocessing directives have a form in which macro expansion can occur. Example #define defined #if defined(x) /* Not expanded. */ 4 #endif EXAMPLE EMPTY # EXAMPLE In: #define EMPTY EMPTY # include <file.h> 1868 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been replaced. This behavior simplifies the job of tools that scan C source (in that they only need to check the first two preprocessing tokens at the start of a line). However, occurrences of EMPTY in other contexts, within a preprocessing directive, may cause complications. 1 #define EMPTY 2 3 #include EMPTY <stdio.h> 4 #include <stdio.h> EMPTY C90 This example was not in the C90 Standard and was added by the response to DR #144. This example does not appear in the Standard. v 1.1 January 30, 2008

11 References 1. D. Atkins, T. Ball, T. Graves, and A. Mockus. Using version control data to evaluate the impact of software tools. In Proceedings of the 1999 International Conference on Software Engineering (ICSE 99), pages , New York, May Association for Computing Machinery. 2. P. J. Brown. The ML/I macro processor. University of Kent at Canterbury, fourth edition, Aug P. J. Brown. Macro Processors and Techniques for Portable Software. John Wiley & Sons, M. D. Ernst, G. J. Badros, and D. Notkin. An empirical analysis of C preprocessor use. IEEE Transactions on Software Engineering, 28(12): , J. Gosling. Ace: a syntax-driven C preprocessor. In Australian Unix Users Group, July ISO. ISO/IEC :1998 Information technology Programming languages FORTRAN Part 3: Conditional compilation. ISO, R. Pike. How to use the Plan 9 C compiler. In Plan 9 Programmer s Manual. AT&T Bell Laboratories, L. Rosler. The evolution of C past and future. AT&T Bell Laboratories Technical Journal, 63(8): , Texas Instruments. TMS370 and TMS370C8 8-Bit Microcontroller Family Optimizing C Compiler Users Guide. Texas Instruments, spnu022c edition, Apr Unix System Laboratories, Inc. Programmer s Guide: ANSI C Programming Support Tools. Prentice Hall, Inc, E. D. Willink and V. B. Muchnick. Preprocessing : Substitution and composition. In Proceedings of the Eastern European Conference on the Technology of Object Oriented Languages and Systems, June January 30, 2008 v 1.1

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Commentary Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 985 postfix-expression syntax postfix-expression:

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1456 6.7.2.3 Tags 6.7.2.3 Tags type contents

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1994 #pragma directive Semantics A preprocessing

More information

fpp: Fortran preprocessor March 9, 2009

fpp: Fortran preprocessor March 9, 2009 fpp: Fortran preprocessor March 9, 2009 1 Name fpp the Fortran language preprocessor for the NAG Fortran compiler. 2 Usage fpp [option]... [input-file [output-file]] 3 Description fpp is the preprocessor

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1378 type specifier type-specifier: void char

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 438 tag 441 If more than one declaration of a

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1439 6.7.2.2 Enumeration specifiers specifier

More information

Have examined process Creating program Have developed program Written in C Source code

Have examined process Creating program Have developed program Written in C Source code Preprocessing, Compiling, Assembling, and Linking Introduction In this lesson will examine Architecture of C program Introduce C preprocessor and preprocessor directives How to use preprocessor s directives

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1722 6.8.1 Labeled statements labeled statements

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1103 6.5.3.3 Unary arithmetic operators 6.5.3.3

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1849 6.9.2 External object s 6.9.2 External object

More information

Gabriel Hugh Elkaim Spring CMPE 013/L: C Programming. CMPE 013/L: C Programming

Gabriel Hugh Elkaim Spring CMPE 013/L: C Programming. CMPE 013/L: C Programming 1 2 CMPE 013/L Pre Processor Commands Gabriel Hugh Elkaim Spring 2013 3 Introduction Preprocessing Affect program preprocessing and execution Capabilities Inclusion of additional C source files Definition

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1566 6.7.5.2 Array declarators 6.7.5.2 Array

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 303 5.2.4.2.1 Sizes of integer types

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 165 5.1.2.2.1 Program startup 5.1.2.2.1 Program

More information

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things. A Appendix Grammar There is no worse danger for a teacher than to teach words instead of things. Marc Block Introduction keywords lexical conventions programs expressions statements declarations declarators

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Commentary Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. unary-expression castexpression unary-expression:

More information

Chapter 7: Preprocessing Directives

Chapter 7: Preprocessing Directives Chapter 7: Preprocessing Directives Outline We will only cover these topics in Chapter 7, the remain ones are optional. Introduction Symbolic Constants and Macros Source File Inclusion Conditional Compilation

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1088 Constraints unary & operand constraints

More information

ISO/IEC JTC1/SC22/WG5 N1247

ISO/IEC JTC1/SC22/WG5 N1247 To: WG5 and X3J3 From: Larry Rolison Date: 24 January 1997 Subject: Proposed alternative draft CD to N 1243 ISO/IEC JTC1/SC22/WG5 N1247 The model of conditional compilation presented in N1243 suffers from

More information

CSCI 171 Chapter Outlines

CSCI 171 Chapter Outlines Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures

More information

Modules:Context-Sensitive Keyword

Modules:Context-Sensitive Keyword Document Number: P0924r1 Date: 2018-11-21 To: SC22/WG21 EWG Reply to: Nathan Sidwell nathan@acm.org / nathans@fb.com Re: Merging Modules, p1103r2 Modules:Context-Sensitive Keyword Nathan Sidwell The new

More information

C for Engineers and Scientists: An Interpretive Approach. Chapter 7: Preprocessing Directives

C for Engineers and Scientists: An Interpretive Approach. Chapter 7: Preprocessing Directives Chapter 7: Preprocessing Directives Introduction Preprocessing Affect program preprocessing and execution Capabilities Inclusion of additional C source files Definition of symbolic constants and macros

More information

A Fast Review of C Essentials Part II

A Fast Review of C Essentials Part II A Fast Review of C Essentials Part II Structural Programming by Z. Cihan TAYSI Outline Macro processing Macro substitution Removing a macro definition Macros vs. functions Built-in macros Conditional compilation

More information

Unit 4 Preprocessor Directives

Unit 4 Preprocessor Directives 1 What is pre-processor? The job of C preprocessor is to process the source code before it is passed to the compiler. Source Code (test.c) Pre-Processor Intermediate Code (test.i) Compiler The pre-processor

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 866 6.4.4.4 Character s 6.4.4.4 Character s syntax

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Objective PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS Explain what is meant by compiler. Explain how the compiler works. Describe various analysis of the source program. Describe the

More information

Appendix A. The Preprocessor

Appendix A. The Preprocessor Appendix A The Preprocessor The preprocessor is that part of the compiler that performs various text manipulations on your program prior to the actual translation of your source code into object code.

More information

Macros and Preprocessor. CGS 3460, Lecture 39 Apr 17, 2006 Hen-I Yang

Macros and Preprocessor. CGS 3460, Lecture 39 Apr 17, 2006 Hen-I Yang Macros and Preprocessor CGS 3460, Lecture 39 Apr 17, 2006 Hen-I Yang Previously Operations on Linked list (Create and Insert) Agenda Linked List (More insert, lookup and delete) Preprocessor Linked List

More information

C Language, Token, Keywords, Constant, variable

C Language, Token, Keywords, Constant, variable C Language, Token, Keywords, Constant, variable A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language. C

More information

Volume II, Section 5 Table of Contents

Volume II, Section 5 Table of Contents Volume II, Section 5 Table of Contents 5...5-1 5.1 Scope...5-1 5.2 Basis of...5-1 5.3 Initial Review of Documentation...5-2 5.4 Source Code Review...5-2 5.4.1 Control Constructs...5-3 5.4.1.1 Replacement

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1788 goto statement Constraints The identifier

More information

Theoretical Part. Chapter one:- - What are the Phases of compiler? Answer:

Theoretical Part. Chapter one:- - What are the Phases of compiler? Answer: Theoretical Part Chapter one:- - What are the Phases of compiler? Six phases Scanner Parser Semantic Analyzer Source code optimizer Code generator Target Code Optimizer Three auxiliary components Literal

More information

OBJECT ORIENTED PROGRAMMING USING C++

OBJECT ORIENTED PROGRAMMING USING C++ OBJECT ORIENTED PROGRAMMING USING C++ Chapter 17 - The Preprocessor Outline 17.1 Introduction 17.2 The #include Preprocessor Directive 17.3 The #define Preprocessor Directive: Symbolic Constants 17.4 The

More information

Conditional Compilation

Conditional Compilation Conditional Compilation printf() statements cab be inserted code for the purpose of displaying debug information during program testing. Once the program is debugged and accepted as "working'', it is desirable

More information

Programming languages - C

Programming languages - C INTERNATIONAL STANDARD ISO/IEC 9899:1990 TECHNICAL CORRIGENDUM 1 Published 1994-09-15 Corrected and reprinted 1995-09-I 5 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION*ME~~YHAPO~HAfl OPTAHM3ALWlfl I-IO

More information

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE

More information

SML Style Guide. Last Revised: 31st August 2011

SML Style Guide. Last Revised: 31st August 2011 SML Style Guide Last Revised: 31st August 2011 It is an old observation that the best writers sometimes disregard the rules of rhetoric. When they do so, however, the reader will usually find in the sentence

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M Jones derek@knosofcouk Copyright 2002-2008 Derek M Jones All rights reserved 825 6441 Integer constants 6441 Integer constants integer

More information

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG) SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2

More information

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead. Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public

More information

Compiler Design. Subject Code: 6CS63/06IS662. Part A UNIT 1. Chapter Introduction. 1.1 Language Processors

Compiler Design. Subject Code: 6CS63/06IS662. Part A UNIT 1. Chapter Introduction. 1.1 Language Processors Compiler Design Subject Code: 6CS63/06IS662 Part A UNIT 1 Chapter 1 1. Introduction 1.1 Language Processors A compiler is a program that can read a program in one language (source language) and translate

More information

COMPILER DESIGN LECTURE NOTES

COMPILER DESIGN LECTURE NOTES COMPILER DESIGN LECTURE NOTES UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing:

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Problem Solving and 'C' Programming

Problem Solving and 'C' Programming Problem Solving and 'C' Programming Targeted at: Entry Level Trainees Session 15: Files and Preprocessor Directives/Pointers 2007, Cognizant Technology Solutions. All Rights Reserved. The information contained

More information

COMPILER CONSTRUCTION LAB 2 THE SYMBOL TABLE. Tutorial 2 LABS. PHASES OF A COMPILER Source Program. Lab 2 Symbol table

COMPILER CONSTRUCTION LAB 2 THE SYMBOL TABLE. Tutorial 2 LABS. PHASES OF A COMPILER Source Program. Lab 2 Symbol table COMPILER CONSTRUCTION Lab 2 Symbol table LABS Lab 3 LR parsing and abstract syntax tree construction using ''bison' Lab 4 Semantic analysis (type checking) PHASES OF A COMPILER Source Program Lab 2 Symtab

More information

10/4/18. Lexical and Syntactic Analysis. Lexical and Syntax Analysis. Tokenizing Source. Scanner. Reasons to Separate Lexical and Syntactic Analysis

10/4/18. Lexical and Syntactic Analysis. Lexical and Syntax Analysis. Tokenizing Source. Scanner. Reasons to Separate Lexical and Syntactic Analysis Lexical and Syntactic Analysis Lexical and Syntax Analysis In Text: Chapter 4 Two steps to discover the syntactic structure of a program Lexical analysis (Scanner): to read the input characters and output

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program.

Language Translation. Compilation vs. interpretation. Compilation diagram. Step 1: compile. Step 2: run. compiler. Compiled program. program. Language Translation Compilation vs. interpretation Compilation diagram Step 1: compile program compiler Compiled program Step 2: run input Compiled program output Language Translation compilation is translation

More information

3 PREPROCESSOR. Overview. Listing 3-0. Table 3-0.

3 PREPROCESSOR. Overview. Listing 3-0. Table 3-0. 3 PREPROCESSOR Listing 3-0. Table 3-0. Overview The preprocessor program (pp.exe) evaluates and processes preprocessor commands in your source files. With these commands, you direct the preprocessor to

More information

COMPILER DESIGN. For COMPUTER SCIENCE

COMPILER DESIGN. For COMPUTER SCIENCE COMPILER DESIGN For COMPUTER SCIENCE . COMPILER DESIGN SYLLABUS Lexical analysis, parsing, syntax-directed translation. Runtime environments. Intermediate code generation. ANALYSIS OF GATE PAPERS Exam

More information

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010 IPCoreL Programming Language Reference Manual Phillip Duane Douglas, Jr. 11/3/2010 The IPCoreL Programming Language Reference Manual provides concise information about the grammar, syntax, semantics, and

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Macros in C/C++ Computer Science and Engineering College of Engineering The Ohio State University. Lecture 33

Macros in C/C++ Computer Science and Engineering College of Engineering The Ohio State University. Lecture 33 Macros in C/C++ Computer Science and Engineering College of Engineering The Ohio State University Lecture 33 Macro Definition Directive: #define #define Example: #define BUFF_SIZE 1000 A

More information

UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING PRINCIPLES OF COMPILER DESIGN 2 MARKS UNIT I INTRODUCTION TO COMPILING 1. Define compiler? A compiler is a program that reads a program written in one language (source language) and translates it into

More information

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful? Chapter 1 :: Introduction Introduction Programming Language Pragmatics Michael L. Scott Why are there so many programming languages? evolution -- we've learned better ways of doing things over time socio-economic

More information

IAR Embedded Workbench MISRA C:2004. Reference Guide

IAR Embedded Workbench MISRA C:2004. Reference Guide IAR Embedded Workbench MISRA C:2004 Reference Guide COPYRIGHT NOTICE Copyright 2004 2008 IAR Systems. All rights reserved. No part of this document may be reproduced without the prior written consent of

More information

C Fundamentals & Formatted Input/Output. adopted from KNK C Programming : A Modern Approach

C Fundamentals & Formatted Input/Output. adopted from KNK C Programming : A Modern Approach C Fundamentals & Formatted Input/Output adopted from KNK C Programming : A Modern Approach C Fundamentals 2 Program: Printing a Pun The file name doesn t matter, but the.c extension is often required.

More information

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation Language Implementation Methods The Design and Implementation of Programming Languages Compilation Interpretation Hybrid In Text: Chapter 1 2 Compilation Interpretation Translate high-level programs to

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

Compiler, Assembler, and Linker

Compiler, Assembler, and Linker Compiler, Assembler, and Linker Minsoo Ryu Department of Computer Science and Engineering Hanyang University msryu@hanyang.ac.kr What is a Compilation? Preprocessor Compiler Assembler Linker Loader Contents

More information

Programming for Engineers C Preprocessor

Programming for Engineers C Preprocessor Programming for Engineers C Preprocessor ICEN 200 Spring 2018 Prof. Dola Saha 1 C Preprocessor The C preprocessor executes before a program is compiled. Some actions it performs are the inclusion of other

More information

#include <stdio.h> int main() { printf ("hello class\n"); return 0; }

#include <stdio.h> int main() { printf (hello class\n); return 0; } C #include int main() printf ("hello class\n"); return 0; Working environment Linux, gcc We ll work with c9.io website, which works with ubuntu I recommend to install ubuntu too Also in tirgul

More information

The Structure of a Syntax-Directed Compiler

The Structure of a Syntax-Directed Compiler Source Program (Character Stream) Scanner Tokens Parser Abstract Syntax Tree Type Checker (AST) Decorated AST Translator Intermediate Representation Symbol Tables Optimizer (IR) IR Code Generator Target

More information

COSC 2P91. Bringing it all together... Week 4b. Brock University. Brock University (Week 4b) Bringing it all together... 1 / 22

COSC 2P91. Bringing it all together... Week 4b. Brock University. Brock University (Week 4b) Bringing it all together... 1 / 22 COSC 2P91 Bringing it all together... Week 4b Brock University Brock University (Week 4b) Bringing it all together... 1 / 22 A note on practicality and program design... Writing a single, monolithic source

More information

CPS122 Lecture: From Python to Java

CPS122 Lecture: From Python to Java Objectives: CPS122 Lecture: From Python to Java last revised January 7, 2013 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

CPS122 Lecture: From Python to Java last revised January 4, Objectives: Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

CODE TIME TECHNOLOGIES. Abassi RTOS MISRA-C:2004. Compliance Report

CODE TIME TECHNOLOGIES. Abassi RTOS MISRA-C:2004. Compliance Report CODE TIME TECHNOLOGIES Abassi RTOS MISRA-C:2004 Compliance Report Copyright Information This document is copyright Code Time Technologies Inc. 2012. All rights reserved. No part of this document may be

More information

Full file at C How to Program, 6/e Multiple Choice Test Bank

Full file at   C How to Program, 6/e Multiple Choice Test Bank 2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)

More information

UNIT I INTRODUCTION TO COMPILER 1. What is a Complier? A Complier is a program that reads a program written in one language-the source language-and translates it in to an equivalent program in another

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #54. Organizing Code in multiple files

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #54. Organizing Code in multiple files Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #54 Organizing Code in multiple files (Refer Slide Time: 00:09) In this lecture, let us look at one particular

More information

This lists all known errors in The C Programming Language, Second Edition, by Brian Kernighan and Dennis Ritchie (Prentice-Hall, 1988).

This lists all known errors in The C Programming Language, Second Edition, by Brian Kernighan and Dennis Ritchie (Prentice-Hall, 1988). Errata for The C Programming Language, Second Edition This lists all known errors in The C Programming Language, Second Edition, by Brian Kernighan and Dennis Ritchie (Prentice-Hall, 1988). The pagination

More information

A Practical Approach to Programming With Assertions

A Practical Approach to Programming With Assertions A Practical Approach to Programming With Assertions Ken Bell Christian-Albrechts Universität Kiel Department of Computer Science and Applied Mathematics Real-Time Systems and Embedded Systems Group July

More information

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

More information

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Object oriented programming. Instructor: Masoud Asghari Web page:   Ch: 3 Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning

More information

CS3157: Advanced Programming. Outline

CS3157: Advanced Programming. Outline CS3157: Advanced Programming Lecture #8 Feb 27 Shlomo Hershkop shlomo@cs.columbia.edu 1 Outline More c Preprocessor Bitwise operations Character handling Math/random Review for midterm Reading: k&r ch

More information

Code Structure Visualization

Code Structure Visualization TECHNISCHE UNIVERSITEIT EINDHOVEN Department of Mathematics and Computer Science MASTER S THESIS Code Structure Visualization by G.L.P.M. Lommerse Supervisor: Dr. Ir. A.C. Telea (TUE) Eindhoven, August

More information

The Make Utility. Independent compilation. Large programs are difficult to maintain. Problem solved by breaking the program into separate files

The Make Utility. Independent compilation. Large programs are difficult to maintain. Problem solved by breaking the program into separate files The Make Utility Independent compilation Large programs are difficult to maintain Problem solved by breaking the program into separate files Different functions placed in different files The main function

More information

UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing: A preprocessor may allow a

More information

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 5 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2016 ENCM 339 Fall 2016 Slide Set 5 slide 2/32

More information

10/5/17. Lexical and Syntactic Analysis. Lexical and Syntax Analysis. Tokenizing Source. Scanner. Reasons to Separate Lexical and Syntax Analysis

10/5/17. Lexical and Syntactic Analysis. Lexical and Syntax Analysis. Tokenizing Source. Scanner. Reasons to Separate Lexical and Syntax Analysis Lexical and Syntactic Analysis Lexical and Syntax Analysis In Text: Chapter 4 Two steps to discover the syntactic structure of a program Lexical analysis (Scanner): to read the input characters and output

More information

Compilers. Prerequisites

Compilers. Prerequisites Compilers Prerequisites Data structures & algorithms Linked lists, dictionaries, trees, hash tables Formal languages & automata Regular expressions, finite automata, context-free grammars Machine organization

More information

ENT 189: COMPUTER PROGRAMMING. H/P: Home page:

ENT 189: COMPUTER PROGRAMMING.   H/P: Home page: ENT 189: COMPUTER PROGRAMMING Dr. PAULRAJ M P, Associate Professor, School of Mechatronic Engineering, #42- Level 2, Ulu Pauh New Campus 02600-Arau. PERLIS Email: paul@unimap.edu.my H/P: 017 5103757 Home

More information

The Make Utility. Independent compilation. Large programs are difficult to maintain. Problem solved by breaking the program into separate files

The Make Utility. Independent compilation. Large programs are difficult to maintain. Problem solved by breaking the program into separate files The Make Utility Independent compilation Large programs are difficult to maintain Problem solved by breaking the program into separate files Different functions placed in different files The main function

More information

The C Preprocessor. Richard M. Stallman, Zachary Weinberg. For gcc version (pre-release) (GCC)

The C Preprocessor. Richard M. Stallman, Zachary Weinberg. For gcc version (pre-release) (GCC) The C Preprocessor For gcc version 8.0.0 (pre-release) (GCC) Richard M. Stallman, Zachary Weinberg Copyright c 1987-2017 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or

More information

Computer Architecture and Organization

Computer Architecture and Organization 6-1 Chapter 6 - Languages and the Machine Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 6 Languages and the Machine 6-2 Chapter 6 - Languages and the Machine Chapter

More information

Stating the obvious, people and computers do not speak the same language.

Stating the obvious, people and computers do not speak the same language. 3.4 SYSTEM SOFTWARE 3.4.3 TRANSLATION SOFTWARE INTRODUCTION Stating the obvious, people and computers do not speak the same language. People have to write programs in order to instruct a computer what

More information

Left to right design 1

Left to right design 1 Left to right design 1 Left to right design The left to right design method suggests that the structure of the program should closely follow the structure of the input. The method is effective when the

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

The New C Standard (Excerpted material)

The New C Standard (Excerpted material) The New C Standard (Excerpted material) An Economic and Cultural Derek M. Jones derek@knosof.co.uk Copyright 2002-2008 Derek M. Jones. All rights reserved. 1524 6.7.4 Function specifiers 6.7.4 Function

More information

Language Reference Manual simplicity

Language Reference Manual simplicity Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna

More information

Table of Contents Preface Bare Necessities... 17

Table of Contents Preface Bare Necessities... 17 Table of Contents Preface... 13 What this book is about?... 13 Who is this book for?... 14 What to read next?... 14 Personages... 14 Style conventions... 15 More information... 15 Bare Necessities... 17

More information

Decision Making -Branching. Class Incharge: S. Sasirekha

Decision Making -Branching. Class Incharge: S. Sasirekha Decision Making -Branching Class Incharge: S. Sasirekha Branching The C language programs presented until now follows a sequential form of execution of statements. Many times it is required to alter the

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

More information