MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

download MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

of 25

Transcript of MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    1/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    INTRODUCTION

    1.1 PROGRAM LANGUAGE DEFINITION

    PROGRAMMING LANGUAGE Is a notation for expressing instruction to be carried out by a computer Is a communication between the human and the machine and often between one

    human being and another.

    1.2 REASON WHY STUDY PROGRAMMING LANGUAGE

    1. To be able to study a new language2. To increase program vocabulary3. To have a better understanding of the language you are using4. To make it easier to design a new language.

    . !uit the needs of the system

    1.3 THE PROGRAMMING FUNCTION IN SYSTEM DEVELOPMENT

    SYSTEM DEVELOPMENT LIFE CYCLE

    "igure 1.#

    REQUIREMENT SPECIFICATION- This step includes a problem definition as well asanalyses of the current system and of the firm$s goals in developing the newcomputer system.

    EVALUATING ALTERNATIVES- These alternative s are tested for feasibilityincluding technological feasibility %&an it be built'() economic feasibility %&an weafford it'( and behavioral feasibility %&an it be implemented with a minimum traumato the firm and its personnel'(

    PURCHASE AND CONSTRUCTION- *nce management decides on the appropriatesystem) it must be +built,. "or hardware this almost always means purchase whilesoftware can either be purchased or constructed.

    IMPLEMENTING AND TESTING- The various components of the system areintegrated and put into working order. The system is tested for errors and these errorare corrected.

    MAINTENANCE- Takes place throughout the lifetime of the computer system

    1 | - a g e

    e/uirement !pecification

    0valuating lternatives

    -urchase and &onstruction

    Implementing and Testing

    aintenance

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    2/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    TRANSFORM

    GENERALIZING THE PROGRAMMING FUNCTION

    THE PROBLEM

    PROGRAMMING MYOPIA- Is characteri ed by dependence on the particular programminglanguage

    THE SOLUTION In order to step beyond language) we must first of all have at least rudimentary

    understanding of many different kinds of languages and many different ways ofprogramming solution. e must understand and generali e the vast conceptualcommonalities in programming languages rather than emphasi e the artificialsyntactic differences.

    THE FUTURE OF PROGRAMMING -rograms are getting larger re/uiring more effort out of more programmers over

    larger periods of time. The ability to use the variety of languages will ensure the best fit for the application. The construction of large program from blocks of relatively independent yet

    interrelated program code has been popular for a long time this type of programdesign has been called modular decomposition of programs.

    PROGRAMMING FUNCTION SPECIFIC CONCERNS ARE: hat hardware will be used' hat people will use the system' hat procedure will the system implement'

    1.4 ABSTRACTION FUNCTION

    ABSTRACTION- Is the means by which we consider only the information that is elevant tothe problem at hand) ignoring trivial details and unimportant facts'

    BLAC BO! MODEL- 5eneral model governing abstraction adapted from theengineering disciplines.

    I6-7T! *7T-7T!

    "igure 1.1

    1." BASIC PRINCIIPLES OF PL

    1.# SYNTA! ules8 format in writing the program 5rammar

    2.# SEMANTICS The meaning of the different syntactical constructs of -9

    3.# PRAGMATICS The uses) origin and effects of the programming language

    1.$ DIFFERENT INTEREST THAT CON%OIN THE STUDY OF PL

    1.# PROGRAMMER Translates the algorithm using a particular -9

    2 | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    3/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    2.# LANGUAGE DESIGNER *ne who lays out the pattern for design of the -9

    3.# LANGUAGE IMPLEMENTER a person or group of persons who design the compiler or interpreter

    1.& CLASSIFICATION OF PL

    G'(')*+ C), '),* /) C+*00, ,( P)/ )* ,( L*( * '0 : The degree to which they are dependent on the underlying hardware

    configuration:

    A. BY LEVEL

    1. L/5-L'6'+- -rogramming language is considered to be machine orientedsince it closely follows the built in instruction set of theunderlying computer.

    2. H, 7 L'6'+- -rovides for more natural expression of lgorithm. it is usuallyproblem oriented) providing the programmer with a high levelof abstraction.

    The degree to which the programs written in that language are processoriented.

    B. BY LANGUAGE CLASS

    1. P)/8'9 )*+

    re process centered they are concern with +how,.

    -rocedural languages statement re/uirement the programmer todevise complete) detailed instructions %in other words) +how, to do it( forevery step the computer will take solving the problem.

    2. D'8+*)* ,6' L*( * '0

    re more data centered.

    ;eclarative language statements enable the programmer to specify)+what, is to be done with the data) rather than detailing +how, is it to beaccomplished.

    The data type that is assumed or that the language handles most easily ;eveloped the 0;C &

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    7/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    Computer

    - configuration in which the processortightly coupled to primary storage)primary storage is large enough to storevast amounts of data along with theprogram code) and operations areexecuted se/uentially without theparallelism that was needed on theearlier machines to counteract theirextremely limited storage capabilities.

    - this design has influenced many of thehigh level programming language.

    UNIVAC - UNIV ersal Automatic Computer

    - The first computer to be available forcommercial sale.

    - The first electronic computer producedspecially for commercial use and one technological feature is that its usesvacuum tubes

    HOWARD AI EN- ;eveloped the @ I

    MAR I- the pre>first generation machinery- it was also known as the utomatic !e/uence> &ontrolled &alculator

    THE SOFTWARE LADDER

    A. T7' 1 0 G'(')* ,/( 1@3&- 1;"2# The era of machine language programming

    ll coding was done in machine language thatis) the computer own internal %binary> based( instruction set

    The word wasn$t programming then) but coding)and programmers were called coders . G)*8' M ))* H/

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    8/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    B. T7' 2 (9 G'(')* ,/( 1;4;- 1;"$#

    The pre> compiler era) saw the development and distribution of machine> codesubroutines) interpretive routines) automatic code generators) andassemblers.

    Aohn auchly) proposed and implemented +!hort> *rder &ode, or +!hort &ode, for the =I6 & % =inary utomatic &omputer(

    computer as a set of interpretivesubroutines stored in memory

    B' H/+=') /( ) developed the S/) M') ' G'(')* /) which was the

    first attempt toward using a computer to write programs.

    T7' P)'

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    9/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    C. T7' 3 )9 G'(')* ,/( 1 ;"4-

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    10/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES PL 1

    - -rogramming 9anguage8*60- The language to end all languages,.- It was a state>of>the>art language that contained virtually every

    conceivable element of language design.- It inherited the features of "* T 6 %its expression and statement

    syntax) share data) and the external procedure() &*=*9 % its data description)record and file handling) and report generation facilities() and 95*9 %its blockstructure) type declarations) and recursion(.

    LOGO- ;eveloped by !eymour -apert of IT) along with a a group of

    researchers and consultants as a &ambridge research firm.- It was designed specifically for mathematics education and was

    actually used experimentally in elementary school classroom in 1FBD

    FORTH- ;eveloped by &harles H. oore for scientific and engineering

    applications yet allow for faster programming using fewer lines of code.

    SIMULA- ;esigned in FB2 by @risten 6ygaard and *le> Aohan ;ahl at the

    6orwegian &omputing &enter under contract with 76IC &- It was motivated by a desire to create a programming language for simulation

    applications> techni/ue of operations research that has since beensuccessfully used in a large number of diverse applications areas > whichwould also serve as a medium for describing the system under study.

    ALGOL$?- revised and extended version of 95*9- Introduced the user> defined data type and the pointer type ) both

    significant features of -ascal.

    PASCAL- ;eveloped by 6iklaus irth) named after the "rench philisopher and

    mathematician =laise -ascal- It was intended to illustrate the direction that 95*9 should have

    taken .

    C LANGUAGE- In 1FD2) =ell 9aboratories$ @enneth Thompson and ;ennis itchie

    developed the & language for coding the routines of the 76IJ operatingsystem.

    - & was an extension of the = language> also designed by Thompson>which itself drew heavily on a earlier systems programming language) =&-9.

    MODULA 2- odular 9anguage- direct descendant of -ascal is another high level language with

    facilities for systems programming.

    - Is characteri ed by strong typing and syntactic style) and) of course)the module) a type of block that can be compiled independently and easilyassembled into program libraries.

    ADA- 6amed after the 1 st computer programmer 9ady ugusta da

    9ovelace) designed according to specifications developed by the 7.!;epartment of ;efense.

    1# | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    11/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    - It was intended for the programming of embedded computersystems

    D. T7' 4 7 G'(')* ,/(- a 4 th generation language is declarative) in other words) its

    instructions to the computer concentrate more on what is to be done ratherthan on describing in detail how to do it.

    - -rogramming are sorter) and easier to code) debug) and maintainPROLOG

    - -rogramming in 9ogic- It was developed by lain &olmerauer and -hilipe oassel of the

    7niversity of arseille$s artificial group) in collaboration with obert @owalskiof the 7niversity of 0dinburgh.

    - It has a firm mathematical basis) grounded as it is in the principles ofpredicate calculus.

    OPS- *fficial -roduction !ystem- ;eveloped at &arnegie ellon 7niversity in 1FD#- Is a production> system) or rule> based) language used in the field of

    artificial intelligence.SMALLTAL

    - designed and implemented in 1FD2 at Jerox -alo esearch &enter%- &(.

    - The language that defines the ob?ect oriented approach toprogramming.

    1.; WHAT MA ES A GOOD PL

    1. W), *=,+,- easy for the programmer to design) code) test) run) document and

    modify programs.- !yntax rules will be clear) simple and consistent

    2. E))/) C7'8 ,(- -9 contains debugging facilities for finding errors that do occurs

    3. R'*9*=,+,- assumes that the program with be read by other technical personnel)

    non> technical ) programmers and users.- It is clear) understandable) and easily modifiable.

    4. S'+ - D/8 '( * ,/(- other forms of documentation usually attached to the source code

    for the benefit of maintenance and programming

    ". E '(0,=,+,- if it enables the programmer to define new language components.

    $. P/) *=,+,- ensure that the language works in the same way on these different

    machines so that a program written in the language and tested on aparticular computer will still work with other computer.

    &. E ,8,'(8- 0fficient use of memory space %as little as possible( and computer

    processing time %as fast as possible(.

    11 | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    12/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    1.1@ CHOOSING A PROGRAMMING LANGUAGE

    FEATURES OF THE APPLICATION

    1. P =+,8 60. P),6* ' C/ < ,(

    Private Computing is computing done by individuals for their own personaland professional use.

    Public Computing programs are written and used by many differentprogrammers

    2. C/ in data types and data

    structures for the application area.

    2. P)/ )* ,( E(6,)/( '(- lso called a Software Development Environment ) is a set of tools

    that includes programming language and serves to aid in programdevelopment.

    0xample: Translator 0ditor) 9inker) nd *nline Help

    3. L'*)(,( C )6'- How easy will it be for a programmer to learn this -9.

    CHAPTER 2

    LANGUAGE PROCESSOR AND RELATED CONCEPTS

    12 | - a g e

    Assembly LanguageStatement

    Assembly LanguageStatement

    ASSEM LE!

    INTERPRETER

    Machine languageInstruction

    Machine languageInstruction

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    13/25

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    14/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES TO ENS

    !eparate pieces of programs re the basic symbols used by the program: identifiers) operators)

    punctuation) language keywords) constants.

    SYMBOL TABLES lso called the dictionary ap program symbols such as variables with their properties such

    types) si e) and relative location.

    SYSNTACTIC ANALYSIS Is concerned with identifying the logical structure of the program in

    accordance with the rules of grammar governing the high levellanguage

    PARSE TREE SYNTA! TREE &ontains the hierarchy of operations in the high>level language

    statements. 0very leaf node contains one of the symbols %tokens( in the

    statement

    ERROR HANDLER ;uring the lexical and syntactical analyses) information regarding

    an error encountered is sent to the error handler module of thecompiler) which will arrange to print out a message to the user.

    INTERMEDIATE CODE GENERATION The result of the lexical and syntactic analyses and the information

    in the symbol table are brought together to produce program code insome intermediate from similar to assembly> language code.

    *utput from the syntactic analysis step) the intermediate codeserves as input to the code generation step.

    *utput from the syntactic analysis step the intermediate codeserves as input to the code generation step.

    OPTIMIZATION To produce efficient code To make more efficient use of main storage and processor time To correct + bad programming practice, "or detecting code that can be moved out of a loop % to improve the

    efficiency of the program) and its logical structure(. ;etection and elimination of dead code DEAD CODE is a program code that is accessible in the normal

    processing of the program and will conse/uently never be executed.

    CHAPTER THREE

    MA%OR ASPECTS OF PROGRAMMING LANGUAGE

    DATA =its of information to be manipulated

    3.2 DATA PRIMITIVE OPERATION

    I. CONSTANT

    14 | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    15/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    Is a data item that remains un changed throughout theexecution of the program

    Calue is unchanged through the program

    USES OF CONSTANTS

    1. L, ')*+

    - is a data value that is used explicitly or literally in a programA. N '),8*+ L, ')*+ /) N '),8 C/(0 *(

    - aybe made up of numeric digit # to F and special character K) >)and

    B. S ),( L, ')*+- aybe composed of any valid characters in the language character

    set and is often enclosed in single or double /uote.0xample : L -rogramming 9anguage$

    C. L/ ,8*+ C/(0 *(- True or "alse

    2. N* '9 C/(0 *(

    - re sometimes termed symbolic constant or figurative constants.- 9ook likes variables because they are identified by a name.0xample : %&*=*9 language(

    !- &0 M0 * HI5H C 970

    II. VARIABLE Is a receptacle for storing data value and each variable is associated

    with a domain of allowable values. 0nable programmer to construct program for which the actual data

    values are not needed until execution. Calue is changed depending on certain conditions.

    CONTROL VARIABLE- 0xist only in relation to the executing program or in the context of

    algorithmic computation and have no relevance to the outside world.0xample :

    Index Cariable % is used to control iteration( ecord 6ames "ile 6ames

    COMPONENT OF A VARIABLE

    1. 6ame2. Type8 !i e> ost important. It determines the domain of values that thevariable is allowed to take on and the set of operations that may beperformed on the variable.3. Calue4. !torage 9ocation

    VALUES MAY BE PROVIDED FOR VARIABLE IN ONE OF THREE WAYS :

    1 | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    16/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    1. Initiali ation when the variable is createdvalued entities operated upon by logical operators such as

    and or) not.ay be taken such values true or false or #) 1.

    4. A99)'00

    *#. L*='+> more properly called a program elements that a data element is

    actually the address of a program statement.

    > *perated by the 5*T* operation

    =#. P/,( ')> eference or +point to, are another data element.

    reference to unnamed data ob?ectII. COMPOUND DATA ELEMENTS

    !ometimes considered primitive data elements and sometimesclassified as data structure.

    1. S ),( n ordered se/uence of character of dynamically changing si e.

    1B | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    17/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES DATA STRUCTURE

    n organi ed collection of data ob?ects sub?ect to certain allowableoperations.

    I. L,('*) Is one in which the individual components are unordered se/uence.

    *. S,

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    18/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    F, )' 3.@9* *

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    19/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    2. SUCCESSOR Its can be stated as: N is successor of -.

    hat data element is next'

    6ode %-( 6ode %N(

    F, )' 3.1

    3. EQUIVALENCE It can be stated as: is e/uivalent to =. Is implied in e/uality) in other words if and = are e/ual) they must be

    e/uivalent.

    OPERATION ON DATA STRUCTURES

    1. CONSTRUCTOR &reate or build> up data structure

    2. DESTRUCTOR ;estroy) or break down data structure

    3. ACCESS -rovides access to the individual components and to groups of a

    data structure by means of one of a variety of referencing methods. ccess may be accomplished by:

    . =y Nualified 6ame 0x. Index @ey=. =y location or subscript

    0x. rray&. =y 6ame

    %by assigning names to data structures(

    4.# PREDICATES

    These =oolean functions test a data structure for the presence of aparticular property

    FILE STRUCTURE The organi ation of data residing in secondary storage and sub?ect to

    input8output related operations.

    FILE Is a collection of related records) related to a particular application.

    RECORD Is a collection of related data items) or fields) related to a single ob?ect of

    processing.

    FIELD Is a data item) a piece of information) either a data element or a structured data item)that is contained within the record.

    CHARACTERISTICS OF FILE

    1.# ACCESS MODE

    1F | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    20/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    The mode) or direction) of access from any par ticular file is determined bywhether the file is to be used for input) for output or both.

    A. I(< F,+' /) )'*9-/(+ ,+'# Is one which ma?ority of accessing operations will be performed

    to read data from the file.

    B. O < ,+' /) * 5), ' /(+ ,+'# Is one in which a ma?ority of accessing operations will be

    performed to write data to the file.

    C. I(< -O < F,+' /) )'*9-5), ' ,+'# Is one) which will be re/uired to accept input and output

    operations in the same application. 0xample: a aster file%permanent files which re/uire regular maintenance(

    2.# PROCESSING MODE The manner in which the file will be used.

    A. B* 87 M/9' eport generation or scheduled retrieval.

    The component records of the file are operated on inse/uential order) often by the value of an identifying key fieldon the record.

    B. Q ') M/9' 7nscheduled or d Hoc etrieval n individual record is operated on by accessing it directly

    from the location in which it has been stored.

    3.# FILE ORGANIZATION The organi ation) in terms of a physical ordering of the records in a file residing on

    secondary storage) implying the appropriate operations for accessing particularrecords.

    A. S' '( ,*+ F,+' linear se/uence of related records that maybe ordered onsome key field.

    B. R'+* ,6' F,+' n unordered collection of component records stored on a

    direct access storage device in which each record may beaccessed directly by location.

    C. I(9' '9 S' '( ,*+ F,+' file storage se/uentially on a direct access storage device

    along with an index) which allows for direct access to a

    particular record in the file.OPERATIONS ON FILES

    1. OPEN !erves to cue the operation system

    2. CLOSE ;eal locates the devise used and frees buffers space

    3. READ

    2# | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    21/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    ssigns the value of the current or re /uested component record to adesignated record variable or input buffer variable.

    4. WRITE &reate anew component record

    ". EOF Tests for + end>of>file, and returns a =oolean value.

    $. MAINTENANCE "or maintenance files re/uiring regular maintenance % aster "ile(.

    A. S/) ,(B. M') ,(C. U scale direct> access storage deviceDBMS D* *=*0' M*(* ' '( S 0 ' #

    !peciali ed ! used to access a database It is the software interface between the physical storage of the data and the use of

    the data in various applications.

    DATA ABSTRACTION language facility that integrates the representation of a programmer> defined data

    ob?ect and the operations that may be performed on that data ob?ect into a singlesyntactic unit.

    3.3 S' '(8' C/( )/+ !tructures which affects the order of execution of statements within programs.

    A. S ) 8 )'0 U0'9 ,( E &ode !e/uence2. Tree> epresentation3. Infix) -refix) -ostfix 6otations

    B. S ) 8 )'0 U0'9 B' 5''( S * ' '( 0 /) G)/ < / S * ' '( 0

    1. B)*(87,(*. C/(9, ,/(*+

    - I 7'( '+0'

    - C*0'- O( G/ / O( G/S ==. U(8/(9, ,/(*+

    - G/ /- G/S =- E ,- R' )(

    2. L//

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    22/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    a. 5eneralb. !pecific

    C. S ) 8 )'0 U0'9 B' 5''( S =

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    23/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES C+*00, ,8* ,/(0:

    . B,(*) O valued arithmeticexpression.

    RELATIONAL OPERATORS K K K # may operate on virtually all types of data and form conditions.

    CONDITION is an assertion of a relation that computes to a =oolean value.

    LOGICAL OPERATORS *(9 /) (/ # *perate on =oolean data and enhance conditions.

    CONDITIONAL E!PRESSION is a form of expression that originated with 9I!-) made its way into 95*9S() and is

    currently used in &. 0xample : %& 9ang.(

    1. =O % =( ' : #If the expression % =( is true) then=O < otherwise =O#

    2. I" % =( =O else bK#

    PRECEDENCE OF OPERATORS%"rom Highest -recedence to 9owest(

    # J - K K K

    4.2 REPRESENTATION OF E!PRESSIONS

    1. P*)'( 7'0, '9 F/) I( , F/) # The one most familiar to us and most commonly relied on in programming. The expression is represented as a linear se/uence of operators and

    operands) which is ordered so as to exploit as much as possible the built> in

    precedence rules of each language.

    F ++ P*)'( 7'0, '9 F/) ;oes not rely on any precedence rules at all< ll operations are contained within parenthesis.

    2. F (8 ,/(*+ F/) This representation may also be called A

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    24/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    epresents all operations as functions< the op erands are arguments to thesefunctions

    !ince operands may be functions as well) this form is characteri ed by repeatedapplication of functions on top of function.

    The operator appears before its operands.

    C* =),9 ' P/+,07 F/) It is the type of functional form employed in 9I!-) which then actually

    makes use of tree structures in evaluating the expressions. The parentheses surround the operator and its associated operands as)

    in general) %f x y( or) for example % dd JGM(.3. T)'' F/)

    The root of each subtree is an operation) its branches are operands. ny function can be represented by a tree.

    L'* N/9'0- are references to data valuesUthat is) they may be constants)variable> names) function references) or array references) theyare not expressions.

    R// N/9'0- is the location that will contain the result computed by theexpression when it has been evaluated.

    4. P*)'( 7'0,0- F)'' F/) ere introduced by a -olish mathematician logician named L * ,*5,8 and

    have come to be known as P/+,07 forms. The se/uence of operators and operands alone are sufficient to indicate the

    order of operations desired by the programmer and no parentheses are needed.

    O)9,(*) P/+,07 F/) P)' , F/) # The convention is to write the operator before the operands This is an efficient means of representing an expression since a streak

    may then be used in its evaluation.R'6')0' P/+,07 N/ * ,/( P/0 , F/) #

    This is used in the language "* TH) is a -ostfix "orm of notation forrepresenting expressions) which is easier to evaluate than ordinary-olish

    The operator follows its operands

    0xample:

    *. M* 7' * ,8*+ /)

    2% K=(

    &> ;

    =. I( , /)

    2 V % K =( 8 % & R ;(

    8. F ++ P*)'( 7'0, '9 F/)

    %2 V % K =( 8 % & R ;((

    24 | - a g e

  • 8/13/2019 MELJUN CORTES MANUAL Programming Languages Compiler CSCI19

    25/25

    CSCI19 - Structures of Programming Language with CompilerPrepared by: ELJUN P. CORTES

    9. F (8 ,/(*+ F/)

    D,6 M + 2 A99 A B## S = C D#

    '. C* =),9 ' F/)%;iv) % ult 2) % ddt % =(( %!ubt&);((

    . O)9,(*) P/+,07 F/) /) P)' , F/)

    8 V 2 = R & ;

    . R'6')0' P/+,07 F/) /) P/0 , F/)

    2 = K & ; 8 8

    7. T)'' F/) B,(*) T)''#

    |

    A

    *2 *+ -

    C DB