⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http:^^cs.nyu.edu^cs^dept_info^course_home_pages^fall96^g221.2110^pl^l5^l5.html

📁 This data set contains WWW-pages collected from computer science departments of various universities
💻 HTML
📖 第 1 页 / 共 2 页
字号:
Date: Tue, 14 Jan 1997 20:09:18 GMTServer: NCSA/1.4.1Content-type: text/htmlLast-modified: Sun, 25 Aug 1996 19:28:37 GMTContent-length: 16261<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN"><!Converted with LaTeX2HTML 95 (Thu Jan 19 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds ><HEAD><TITLE>Lecture 5</TITLE></HEAD><BODY><meta name="description" value="No Title"><meta name="keywords" value="L5"><meta name="resource-type" value="document"><meta name="distribution" value="global"><P>Lecture #5Programming Languages <!WA0><IMG  ALIGN=BOTTOM ALT="" SRC="http://cs.nyu.edu/cs/dept_info/course_home_pages/fall96/G221.2110/PL/L5/img1.gif"> MISHRA <P><HR><H3> G22.2210</H3><P><H1> Programming Languages: PL</H1><P><H3> B. Mishra<BR>  New York University.<BR>  <BR>   <BR>   <b> Lecture # 5</b><BR></H3><P><H3> ---Slide 1---<BR><em> The ADA Programming Language</em><BR> <b> Language Survey 2</b><P><P><P><UL><LI> <em> Countess Ada Augusta Lovelace</em><BR> <H4> First programmer (hacker) on Babbage's <em> Analytical Engine</em>.</H4><P><H4> <LI> Relatively new programming Language (1980) developed by DoD.Currently, the only language approved for DoD software project<P> <LI> Developed to reduce high cost of <em> designing</em>, <em>writing</em> and <em> maintaining</em> DoD software.<P> <LI> Major items of software are for ``<b> embedded systems</b>''</H4><H5> <UL><LI> Primary purpose is control.  <LI> Incorporated in larger systems.  <LI> Large software: 50,000--100,000 lines of code  <LI> Long-lived systems (10--15 years)  <LI> Continuously evolving. </UL><P></H5></UL><P>---Slide 2---<BR><em> The Design History</em><P><P><P><H4> <UL><LI> 1975: HOLWG (High Order Language Working Group) was established       to investigate problems of developing common language for DoD. <LI> 1975--1978: List of requirements:       <em> STRAWMAN</em>, <em> WOODENMAN</em>, <em> TINMAN</em>, <em>       IRONMAN</em>, <em> Revised IRONMAN</em>, and finally <em>       STEELMAN</em>  <LI> Design Competition:<BR>        Winner: Jean Ichbiah, Cii Honeywell Bull <LI> 1987: Ada ISO Standard 8652 <LI> 1983--1987: Analysis of Technical Queries by ARG (Ada       Rapporteur Group). Resulted in AIs (Ada Issues). <LI> 1988: DOD (and ANSI) established Ada 9X project. <LI> 15 Feb 1995: Ada 95. Core Language + Specialized Annexes</UL></H4><P>---Slide 3---<BR><em> Quick Overview (Ada 83)</em><P><P><P><UL><LI> Strong Typing<BR> <H5>       Scalar, Composite, Access, Private &amp; Derived</H5><P><LI> Representation Specification<P><LI> Standard Control Constructs:<BR> <H5>       Structured Language--Pascalish</H5><P><LI> Subprograms: Procedures &amp; Functions<P><LI> Program Structuring Facilities: Packages<P><LI> Generics: Polymorphisms<H5>       Extends the concept of type and functional abstractions</H5><P><LI> Exceptions<P><LI> Separate Compilation<P><LI> Tasking (Rendezvous)<P></UL><P>---Slide 4---<BR><em> Quick Overview (Ada 95)</em><P><P><P><UL><LI> Object Oriented Programming<P><LI> Program Libraries<BR> <H5>	(Replaces Ada 83's flat structure by a hierarchy---Visibility	Control and Program Extension without recompilation)</H5><P><LI> Interfacing<BR> <H5>       Graphical User Interface (GUI)---Program Call-back.</H5><P><LI> Tasking (Static Monitor)<P></UL><P>---Slide 5---<BR><em> Ada Type System</em><P><P><P><UL><LI> Programmer Defined Types<BR> <H4>      Set of values, Applicable set of operations and set of properties,      accessible via <code>attributes</code></H4><P><LI> <H4><b> Type Definition</H4></b> <H5> <PRE>  type &lt;identifier&gt; is &lt;type-definition&gt;</PRE> </H5><P><LI> <H4><b> Type Binding</H4></b> <H5> <PRE>  &lt;variable&gt; : &lt;type&gt;</PRE> </H5><P><LI> <H4> <b> Attributes</H4></b> <H5> <PRE>  &lt;name&gt;'&lt;attribute-identifier&gt;</PRE> </H5></UL><P>---Slide 6---<BR><em> Examples</em><P><P><P><H5> <PRE> type DAY is (MON,TUE,WED,THU,FRI,SAT,SUN);    --Enumeration Type TODAY: DAY; TOMORROW: DAY; CURRENT_DAY: DAY; HOURS_WORKED: array(DAY'FIRST..DAY'LAST)                    of INTEGER; if TODAY &lt;= FRI then    TOMORROW := DAY'SUCC(TODAY); for CURRENT_DAY in DAY'FIRST..DAY'LAST loop    ... end loop;</PRE></H5><P>---Slide 7---<BR><em> Primitive Scalar Types</em><P><P><P><UL><LI> Discrete Types<BR> <H4><em> i) Enumeration Types, ii) Character type,<BR>  iii) Boolean Types, iv) Integer Types</H4></em><P><LI> Real Types<BR> <H4><em> i) Fixed-Point Types, ii) Floating-Point Types</H4></em><P><LI> <b> Note:</b><H4>       Integer and Real types together form the <em> numeric types</em>.</H4><P><LI> <code>INTEGER</code> <b>=</b><H4>      Predefined integer types<BR>       <code>SYSTEM.MIN_INT..SYSTEM.MAX_INT</code></H4><P><LI> Operation<BR> <H5>      <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code> (Arithmetic operations)<BR>       <code>&lt;</code>, <code>&lt;=</code>, <code>=</code>, <code>/=</code>, <code>&gt;=</code>, <code>&gt;</code>      (Logical operations)</H5><P></UL><P>---Slide 8---<BR><em> Discrete Types</em><P><P><P><UL><LI> <b> Note:</b><H5>      Characters &amp; Boolean are predefined <em> enumeration types</em><P>      Characters <b>=</b> 128 ASCII characters: '<code>A</code>', '<code>B</code>','<code>C</code>', <!WA1><IMG  ALIGN=BOTTOM ALT="" SRC="http://cs.nyu.edu/cs/dept_info/course_home_pages/fall96/G221.2110/PL/L5/img2.gif"><P>      Booleans <b>=</b> <code>FALSE</code> &amp; <code>TRUE</code></H5><P><LI> <H4>       All discrete types are <b> ordered</b>: <code>FALSE</code> <b>&lt;</b><code>TRUE</code>.</H4><P><LI> <H4>      Discrete type values can be used for <b> indexing</b> &amp; <b>iteration over loops</b>.</H4><P><LI> <H4>      Attributes of Discrete Types (e.g., <code>T</code> )</H4><DL ><H5>  <DT><code>T'POS</code>:<DD> Position Number  <PRE>  SUIT'POS(HEARTS) = 0</PRE><P>  <DT><code>T'VAL</code>:<DD> Inverse of <code>POS</code>  <PRE>  SUIT'VAL(0) = HEARTS</PRE><P>  <DT><code>T'SUCC</code>, <code>T'PRED</code><DD><P>  <DT><code>T'FIRST</code>, <code>T'LAST</code><DD> </H5><P> </DL></UL><P>---Slide 9---<BR><em> Real Type</em><P><P><P><UL><LI> <H4><b>         Floating Point:<BR> Accuracy is fixed by a <em> relative</em> error bound</H4></b><H5> <PRE> type WEIGHT is digits 10;</PRE>Values have an accuracy of 10 digits.</H5><P><LI> <H4><b>         Fixed Point:<BR> Accuracy is fixed by a <em> relative</em> error bound</H4></b><H5> <PRE> type VOLTAGE is delta 0.1 range 0.0..1.0;</PRE>Values have an accuracy at least as fine as 0.1.</H5><P><LI> Some Attributes<BR> <H4>       <code>FX</code> = Fixed Point: <!WA2><IMG  ALIGN=MIDDLE ALT="" SRC="http://cs.nyu.edu/cs/dept_info/course_home_pages/fall96/G221.2110/PL/L5/img3.gif">..<!WA3><IMG  ALIGN=MIDDLE ALT="" SRC="http://cs.nyu.edu/cs/dept_info/course_home_pages/fall96/G221.2110/PL/L5/img4.gif"></H4><H5> <PRE>  FX'DELTA, FX'LARGE</PRE></H5><P><H4>       <code>FL</code> = Floating Point:       <!WA4><IMG  ALIGN=MIDDLE ALT="" SRC="http://cs.nyu.edu/cs/dept_info/course_home_pages/fall96/G221.2110/PL/L5/img5.gif">; mantissa has <b>B</b> digits.</H4><H5> <PRE>  FL'DIGITS, FL'MANTISSA, FL'EMAX,  FL'SMALL, FL'LARGE, FL'EPSILON</PRE></H5></UL><P><P>---Slide 10---<BR><em> Derived Type</em><P><P><P><UL><LI> Specific Type <b>+</b> <em> Constraints</em><BR> <H4>    E.g., Range Constraints for scalar</H4><P><LI> Examples<H5> <PRE>  subtype BYTE_SIZE is INTEGER range -2**7..2**7;  subtype CAPS is CHARACTER range 'A'..'Z';  subtype &lt;identifier&gt; is &lt;parent-type&gt; range &lt;constraint&gt;;</PRE></H5><P><LI> <b> Object Declaration</b><H5> <PRE> X, Y: constant INTEGER range 0..128 = abs(N); &lt;identifier&gt;: &lt;mutability&gt; &lt;type&gt; &lt;constraint&gt;          = &lt;init-value&gt;;</PRE></H5><P><LI> <H4>      Range constraint can be tested at runtime</H4><H5> <PRE>  if CURRENT_INPUT not in CAPS then ...</PRE></H5></UL><P><P>---Slide 11---<BR><em> Assignment Statement</em><P><P><P><PRE>         X := Y;</PRE><P><UL><LI> <b> Types must match</b> <UL><H4>  <LI> Same type name--Not structure. Ada uses <em> name equivalence</em>.  <LI> Type checking is at compile time.  <LI> Type mismatch <!WA5><IMG  ALIGN=BOTTOM ALT="" SRC="http://cs.nyu.edu/cs/dept_info/course_home_pages/fall96/G221.2110/PL/L5/img6.gif"><BR>       Program considered <em> illegal</em>. </H4> </UL><P> <LI> <b> Subtype constraints</b> <UL><H4>  <LI> Compatibility condition: type(X) <!WA6><IMG  ALIGN=MIDDLE ALT="" SRC="http://cs.nyu.edu/cs/dept_info/course_home_pages/fall96/G221.2110/PL/L5/img7.gif"> type(Y) 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -