Home Technology C Programming Language with Unix Systems Portability Analysis

C Programming Language with Unix Systems Portability Analysis

by admin
237 views

What architectural structures do the description of the original C compiler illustrates? Explain. 

The first c compiler was created for the PDP-11 systems that ran on UNIX systems as early as 1972. This compiler’s architectural structure did not try to achieve portability among several machines but to achieve the functionality. The original compiler had no way of accounting for overlaying data in a machine-independent manner. The structure allowed for cheating to indicate the fact that possible floating values and integer might be overlaid. It means that floating values and integers could not exist at the same time. These could not be expressed portable because the original c compilers could not represent floating-point data and integers’ relative sizes in a machine-independent way.

C Programming Language with Unix Systems Portability Analysis

What architectural structures do the description of the Portable C compiler illustrates? Explain. 

The structure of a mobile C compiler was designed to be adaptable to a variety of computers, not just UNIX machines. The compact compiler’s architectural framework could be quickly changed. There were around 8000 lines of code in the compiler, and less than 20% of it was machine-dependent. Since the structure has a significant portion of similar code in several programs, such as the IBM System/370, maintaining the c compiler code is easy. Even, the Honeywell 6000, Inter-data 8/32, SEL86, or even the DEC VAX-11/780 in eclipse. Its layout also contains an intermediate file that can be located in the interface between the portable c transfers. This file includes character illustrations of stereotyped programming for epilogues and subroutine prologues, as well as examples of expression trees.

What architectural constructs does the UNIX portability description demonstrate? Justify your role.

The structural design of a compact UNIX system was born out of the fact that certain machines’ operating systems had hardware structures that made the UNIX system difficult to introduce. The plan was to provide a C compiler that could be changed easily and generate new code for a variety of machines. The c programming language was to be generalized to enable certain c applications to be portable to a wider variety of devices and to define non-portable constructions. It depicts the structure of re-coding a code, in this case the c language, to allow for the identification and isolation of system dependencies. It will also enable portability to be demonstrated by using it in other computers.

According to the report, what sacrifices or trade-offs were made in the Portable C compiler’s design?

The compact C compiler had to abandon its optimality in favor of heuristic algorithms in order to produce effective and suitable code in a fair amount of time. The portable c compiler had to strike a compromise between generating machine-independent code and certain machine-dependent code lines when it was created. The machine-dependent lines of code handled the first pass that holds lexical, syntax analysis and symbol table management and generates machine-dependent code like epilogues and subroutines is made up of machine-dependent lines of code especially.

Based on the paper, what were the compromises or trade-offs in the design of UNIX? 

The UNIX system was designed in c language that is mainly used in network programming. Therefore, in its design, UNIX systems compromised ultimate portability for more efficiency. The Unix systems have been designed to strike a balance between powerful and convenient features. This also has to consider how implementation of some features efficiently on different machines is achieved.

Write a Module Guide for the Portable C compiler.  

 The design of a portable c compiler has to be constituted with three modules.

  • Storage allocation
  • Stereotyped code sequence for switches, labels and subroutine exit and entry points.
  • Code production for expressions

Treating the Portable C compiler as a product family (Johnson and Ritchie, 1978)

What are the Commonalities? 

The c language belonged to the traditional procedural family comprised of BCPL, B, and C that was typified by both FORTRAN and Algol 60. The similarities of these languages include:

  • They are system-programming languages.
  • These languages can easily accommodate translations with relatively simple compilers.
  • They use library routines for input and output and other interactions with operating systems.
  • These languages are compactly described and are relatively small.
  • These languages’ abstractions are quickly grounded in the elaborate data types and operations given by conventional computers.
  • These languages use library procedures to specify control structures like procedure closures and co-routines.
  • These languages achieve portability between machines since their abstractions lay at a high level.

What are the Variabilities? 

  • B and C languages have no nested procedures, while procedures can be nested in the BCPL language but cannot refer to non-static objects defined in the containing systems.
  • BCPL and C can recognize separate compilations except for the earlier versions of the B language.
  • BCPL and C both provide a means through which text from a named file can be include, but the B language does not provide for this.
  • C, B and BCPL languages differ very significantly in their syntax.
  • Lexical and syntactic mechanisms of BCPL are regular and more elegant than the syntactic and lexical means of both the B and C languages.
  • B and C language end their statements with semicolons.
  • Most semicolons in BCPL are elided after statements that end in a line boundary, giving convenience.
Works Cited;
  • C. Johnson, D. M. Ritchie Portability of C Programs and the UNIX System (1978).
  • C. Johnson, “A Portable Compiler: Theory and Practice,” Proc. 5th ACM Symp. On Principles Of Programming Languages (January 1978)
  • M. Ritchie, S. C. Johnson, M. E. Lesk, and B. W. Kernighan, “UNIX Time-Sharing System: The C Programming Language,” B.S.T.J., this issue, pp. 1991-2019.
  • Snyder, a Portable Compiler for the Language C, Cambridge, Mass.: Master’s Thesis, M.I.T.,1974.

related articles

Leave a Comment