1 / 33

2. The NUT Language (procedural part)

2. The NUT Language (procedural part). 2.1 Pro cedure texts. Pro c edu res encode imperative algorithms for manipu- lating objects. Pro c edu res can be programmed or unprogrammed. <pro c edur e -te x t>::= <programme d -pro cedure -te x t>|< un prog-pro c -te x t>

theresej
Download Presentation

2. The NUT Language (procedural part)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 2. The NUT Language(procedural part) 2.1 Procedure texts Procedures encode imperative algorithms for manipu- lating objects. Procedurescan be programmed or unprogrammed <procedure-text>::= <programmed-procedure-text>|<unprog-proc-text> <programmed-procedure-text>::= <protsedure-specification>{<program>} / axiom <unprog-proc-text>::= <protsedure-specification>{spec} / \ Determinesthe input/output interface, Program will be synthesized parameters order and roles(input,output,weak) by specification In the texts of NUT packages, the proc. texts appear in two kind of positions: as relation definiences(1.8.3) and asprog objects definiences in new express-s. (2.4.5)

  2. NB! The main programs of NUT packages do not have parameters. They are written in the NUT main window. 2.2 Specifications Specifications of procedures are used in two ways: - they determine how parameter passing should be carried out in procedure calls and subtask calls, - specifications of programmed relations are interpreted as axioms about computability in synthesis. <procedure-specification>::= [<subtask-specification>]<procedure-pattern> <subtask-specification>::= <subtask-specification>[,<subtask.-specification.>]... Subtasks are a special kind of input parameters of procedures. They have always classprog. <subtask-specification>::= [[<userclass-name>|-]<subtask-pattern>] / if given, than the subtask iscalledindependent

  3. <procedure-pattern>::= [<dotnames>][--<dotnames>]->[<dotnames>] |--[<dotnames>] \ all dotnamesare parameters of the procedure <subtask-pattern::= <dotnames>-><dotnames> | alldotnames areparameters of the subtask The names to the left -> (and -- ) in the pattern of a procedureor a subtask are names of the input parame- tersof the procedure or subtask. The names to the right of -> are names of output parameters. The names to the right --, but not to the right of -> in the pattern of a procedure are weak parameters of the procedure. In an explicit call of a procedure, its weak Parameters function as input-output parameters. For a call of a progobject, the parameters of its specification are formal. Unprogrammed procedures are not allowed to have subtasks and weak parameters.

  4. 2.3 Programs Programs encode imperative instructions for manipulating objects. /empty program is not allowed <program>::= <statement> <statement>::= <assignment> |<function-call> see.2.4.3 |<procedure-call> |<subtask-call> |<compute-statement> |<sequence> |<empty-statement> |<if-statement> |<for-statement> |<do-statement> |<exit-statement> 2.3.1 Assignments Assignments are used for changing values of objects. <assignment>::= <dotindexname><assign-symbol><expression>

  5. <dotindexname>::= <indexname>[.<simplename>[[<expression>]]] <indexname>::= <atomicname>[[<expression]] <atomicname>::= <simplename>|<row-element-name> <assign-symbol>::= :=|<- / \ copyingcopying a reference to a value of a value Expressions see 2.4 anytype object is concretized into that of the assigned value. Examples p2.x:=1*cos(alpha)+p1.x table[length(table)+1]<-a.state string:=´this is a text´ tri<-(new triangle alpha:=0.7)

  6. 2.3.2 Procedure calls Procedure calling is one of the main tools of manipulating objects in the NUT system. <procedure-call>::= <relation-call>|<prog-object-call> Relation call corresponds to message send. in OO lang. <relation-call>::= [<receiver-name>.]<relation-name>(<expressions- and-holes>) <receiver-name>::= <simplename>|<userclass-name> <prog-object-call>::= <simplename>(<expressions-and-holes>) The receiver name in a relation call determines the receiver. If the receiver name is a simple name, then it refers: - to a first-level object, where the call appears; - to a component of the SELF-object, i.e. of the object who is performing the program where the rel. call app.; - or to a global object. If no receiver name is given, relation is perform. bycl.

  7. In the case of <prog-object-call> it refers to the same alternatives. Using expressions seebelow 2.4. Examples: a.put(b.x+3, ,length(b.x)) c.get() 2.3.3 Subtask calls Subtask calls may only appear in the programs of procedures (i.e. not in main programs). <subtask-call>::= subtask<unsigned-integer>(<expressions-and- / holes>) This is subtask number Example: subtask 2(in,out) 2.3.4 Compute-statements Compute-statement promts calculation of compo- nents of objects.

  8. <compute-statement>::= <simplename>.compute([<dotnames>]) / \if names are omitted, then all proper object name, whosecomponentscomponents have to be computed have to be computed Minimize - on - gives an error, if compute all comp. - off – gives not Example: tri.compute(alpha,b) 2.3.5 Sequences and the empty statement <sequence>::= <statement>;<statement> Example: x:=y+2; b:=new array x of num An empty statement is also possible. <empty-statement>::=

  9. 2.3.6 if-statements if-statements encode choices between guarded alternatives. <if-statement>::= [<label>:]if<alternatives>fi <alternatives>::= <alternative>[||<alternative>]… <alternative>::= <expression>-><statement> <label>::= <identifier> The expression must evaluate to a boolean value. If all guards evaluate to false, nothing happens. Example: if x[i]>max->max:=x[i] ||x[i]<min->min:=x[i] fi

  10. 2.3.7 for-statements for-statements encode loops whose iteration is controlled by a numeric control variable. <for-statement>::= / NB!num [<label>:]for<simplename>[:=<expression>][step<ex pression>]to<expression>do<statement>od | / \ must evaluate the numbers Ifinitial value expressen is omitted, the in. value is 1. Ifthe step expressen --”-- --”-- --”--. Example: for i to n do tab.x[i]:=i+1 od 2.3.8 do-statements do-statements encode loops whose iterations is controlled by guards of alternatives. <do-statement::= [<label>:]do<alternatives>od At every round of iteration, the guards of the alternati-

  11. ves are evaluated consecutively until an alternative with true guard is found, and alt. body is performed. The execution of the loop terminates by g. are false. Example: L: do c_button(0)-> NutPrint(´The left button is pressed´) || c_button(1)-> exit L || true-> NutPrint(´Nothing happens´) od 2.3.9 exit-statements An exit-statement forces exiting from an enclosing if-, for- või do-statement, or the whole program. <exit-statement>::= exit [<label>] If a label is indicated in an exit-statement, then a state- ment with the given label is exited. Otherwise, the enclusing program is exited. Examples: exit bst exit

  12. 2.4 Expressions Expressions are constructions that encode values, used in programs and initialization amendments. Evaluation of an expression may have side-effects (e.g. change the values of some objects or the like). <expression>::= <constant> |<dotindexname> |<operator-expression> |<function-call> |<procedure-call> |<structure-expression> |<new-expression> |(<expression>) Procedure calls were explained inSec 2.3.2 Sec 1.8.3 <expression-in-equation> are used dotnames only.This is a simplification where dotindexname is not allowed. Examples: a^(b*x)+(-c)^2 -sqrt(a)-(ln(b)/2-c)

  13. (a/=nil)&(b>=2|c) -method(a) delete(a,pos(´This is a text´,´text´),length(´text´)) In different sections we have used <expressions> and <expressions-and-holes> which haves the following structure: / omittedelements <expressions>::= [<expression>[,<expression>]…] <expressions-and-holes>::= [<expression>][,[<expression>]]... 2.4.1 Constants Constants evaluate to fixed primitive values. <constant>::= <number>|<string>|true|false|nil / \ \ / \ class num class text class bool an undefined value in every class

  14. 2.4.2 Operator expressions Operators are predefined functions with simplified call syntax. They transform input values of certain classes into output values of certain classes. Operator expressions are calls of operators. <operator-expression>::= <unary-operator><expression> |<expression><binary-operator><expression> <unary-operator>::= -|~ <binary-operator>::= +|-|*|/|^ |&| | |==|/= |>|<|>=|<= The value of an operator expression is the result of app- lying the operator to the values of the operand express. The operators have the following semantics: - negation (num->num) +,- addition,subtraction (num.num->num) *,/ multiplication,division (num,num->num) ^ power (num,num->num) ~ negation (bool->bool)

  15. &,| conjunction,disjunction (bool,bool->bool) ==|/= identical, not identical (x,x->bool) <,>,<=,=> lt,gt,le,ge (num,num->bool) The priorities: - ~ * / & + - | == /= < > <= => Examples: (a>=3)==true 2^10-n*3 2.4.3 Function calls Functions transforms input values of certain classes into output values of certain classes. <function-call>::= <function-name>(<expressions>) \arguments <function-name>::= <std-function-name>|<C-function-name> / \ Restr. on using stand. function names as comp. namesIn special library

  16. Examples: NutPrint(´Hello world!´) gr_text(f,(new Point x:=20, y:=30),´Cheers´,1) asin(x+0.1) 2.4.4 Structure expressions Structure expressions are used for forming struct values. <structure-expression>::= [<expressions-and-holes>] A hole in a structure expression is just a shorcut for constant nil. Example: [3,4,5,´Hello´,(new square a:=8), ,[2,true]] 2.4.5 new-expressions new-expressions are used for dynamic instantiation of objects from classes and prototypes. <new-expression>::= new<class-nime> |new<userclass-name><prototype-in-new-expression> |new prog<programmed-procedure-text>

  17. The value of the expression is the object that was created. The new-expression will be typically assigned to an object with name (that previously had class any and value nil.) The usage of prototypes in new-expression is the simi- lar to their usage in component declaration in user class texts, see 1.8.2,1.8.6. NB! Only initialization amendments are allowed here. <prototype-in-new-expression>::= <userclass-name><initialization-amendsments> <initialization-amendsments>::= <initialization-amendsment>[,<initialization-amen.>]... <initialization-amendsment>::= [<simplename><assign-symbol>]<expression> / / Components of the object being creatednames here refer to objects of the current object context Examples: new triangle a:=5, beta:=0.8, 0.6 new array 100 of text new prog x,y->z{z:=sqrt(x^2+y^2)}

  18. SUN computers 1. SUN – 30 years 2. SUNi hardware 3. SUN prices 4. SUN computers network in the Institute of Cybernetics 5. SUN software 6. New steps ... Masinprojekteerimine * A.Kalja * Arvutitehnika instituut

  19. SUN 30 years 1982 foundation of SUN company. FirstSUN-1. 1983 FirstSUN-2. Company has started intern. B. 1984 FirstNFS. 1985 FirstSUN-3. 1986 Over 10 000 systems sold. 1987 First SUN-4/260 . Over 50 000 systems sold 1988 Over 100 000 systems sold 1989 First SPARCstation 1 1990 FirstSPARCstation 2. 1991 FirstSPARCserver 600MP. over 500 000 systems sold. 1992 SPARCstation 10. 1993 … SPARCclassic SPARCstation 5 SPARCstation 20 SPARCstation 4 UltraSPARC 5, 10 JavaStation Masinprojekteerimine * A.Kalja * Arvutitehnika instituut

  20. Examples of CAD hardware from 1990 Computer PC 386 SUN 3 ********************************************** Op. memory 1 Mbyte... 4...16 Mbyte 16 Mbyte Type of processor Intel 80386 MC68020 Speed 16-33 MHz 20 MHz HD 52-200 Mbyte 327 Mb...1.3Gb HD + discette 1.2 Mb 5” 1.44 Mb 3,5” Monitor Raster display Raster display 256 colours 19” BW 800x600 1152x900 16 colours or colour 1024x768 or BW 1600x1280 Network is is (Ethernet) connection Size 15,8x38x42 cm 8,4x53,6x44,2 cm Power 145 W 145 W Produced 1990 1987 OS MS-DOS 5.0 SUN OS 4.1

  21. SUN SPARCstation computers (90-s) Computer IPC 386 ELC SPARCstation2 Station10 ******************************************************** Processor SPARC SR SR Superscalar RISC SPARC Ver. 8 17,4MIPS 21MIPS 28,5MIPS Op. memory 8…48Mb 32…128Mb 8…64 Mbyte till 512 MB Inside 207 Mbyte - till 848Mb 2x424Mb HD või 1 GB Outside till till till 10,4GbHD 15,6Gb 5,2Gb 20,8Gb n time Monitor Colour B/W Colour/B/W OS SunOS SunOS SunOS Solaris 1.1 Software C, Pascal, Modula-2, Fortran, C++ Sun Common LISP, Cobol, … Environment 10…40o C 0…40o C non conditioned air 20-80% humidity 5-95% Size 17,7x24,4x26,4 cm 7,1x40,9x40,9 cm 7,1x24,4x26,4 cm 7,6x41,7x40,9 cm Power 160 W 400 W Weight 5,45 kg 6,9 kg? 10,4 kg 9,1 kg

  22. SUN’i SPARCstation computers (continue) SPARCstation LX SPARCclassic Processor SPARC Version 8, MicroSPARC 50 MHz MIPS 59,1, MFLOPS 4,6 Main memory to 24 Mb (4 Mb SIMM) to 96 Mb (16 Mb SIMM) Standardinterface Ethernet, SCSI järj., parall. Audio, ISDN, Sbus Inside HD 207, 424 Mb või 1Gb Outside HD to 21 Gb Other memories 3,5” floppy 644 Mb CD-ROM 150 Mb tape Graphics SPARCstationLX fast, 8-byte 2-D/3-D graphics monitor to 1600x1280 Monitors 15” 1024x768 16” 1280x1024 1152x900 18” M/V 1152x900 Keyboard 101 Mouse optical, three buttons Software Solaris 2.1 OpenWindows 3. C,C++,Pascal,Fortran, ONC,NFS,TCP/IP, SunNet OSI, MHS Environment 0...400 C 5-95% humidity 400 W Size LX 11,6x24,4x26,4 cm 12.7 kg monitors weight 17,0...38,6 kg

  23. IPX price for university (1. aug. 92) ECU SPARCstationIPX 4/50 MX-16-P40 9317.71 • 16” mono monitor • 207 Mb sisemine ketas • 16 Mb mälu Lisamälu 16 Mb X116U 1435.42 Lisaketas 1.3 Gb X571A 4956.73 150 Mb lindiseade X660A 1766.91 Sun CD seade X559A 1110.18 SunOS CD kettal SX-21 234.55 SunOS kasutus- SS-23 562.91 juhend CD-l OS kasutaja- SYSLUN 2204.73 litsents Ethernet’i transiiver 312.73 ---------- Kokku 21901.85

  24. SUN SPARCclassic price (1. aug. 93) • SPARCclassic 4/15DC-16-P43 1 • - 15” COLOR MONITOR • - 16 Mb RAM • - 424 MB Internal SCSI-2 DISC • 2. AUI Adapter Cable X981A 1 • 3. North American Universal X3501R 1 • Country Kit • 4. Continental Europe Power X312L 2 • Cord Kit • 5. SOL-C Solaris 2.x Media 1 • -------------------- • ~100 000.- EEK • 1 EURO=15,6466 EEK

  25. Sun Blade 150 Workstation Architecture: UltraSPARC[tm] IIi Clock Rate:n: 550 MHz or 650 MHz External Cache: 512 KB Main Memory: 2-GB maximum (with four 512-MB DIMMs) … Audio: Four audio ports: headphone(out), line-in, line-out and microphone(in) using EIA standard 0.125-inch (3.5-mm) jacks Ethernet: One ethernet/fast ethernet (10BASE-T/100BASE-T) twisted-pair standard connector (RJ-45), self-sensing Graphics: One graphics port (HD15), onboard 24-bit frame buffer IEEE 1394: Two IEEE 1394 (6-pin) connectors Keyboard and mouse: USB (uses one of the four standard USB (Type A) ports) Parallel: One IEEE 1284 (bidirectional) parallel port (DB25) PCI: Three full-size PCI slots, 33 MHz, 5/3.3 volt Serial: One asynchronous serial port (DB9) Smart Card Reader: The smart card interface (10-pin) connector conforms to ISO 7816.3 USB: Four standard Universal Serial Bus (USB) Type A connectors … Height: 11.8 cm (4.6 in.) Width: 45.7 cm (18 in.) Depth: 44.6 cm (17.6 in.) Weight: 12.2 kgs (26.9 lbs.)

  26. First Estonian connections to the Internet Amsterdam Nordunet Funet HY Sunet Helsinki Inst.of Cyb. KTH Tallinn Stockholm KBFI BIO.CENTR. Tartu ahto@ioc.ew.su ahto.kalja@cs.ioc.ee

  27. 1. Login: Solaris (anna) login: ahto password: … anna{ahto}%: 2. File system / tmp home etc usr ioc staff ahto Mail calender 3. File system permissions OWNER READ(r) GROUP WRITE(w) OTHER EXECUTE(x)

  28. 4. Commands command option expression filename cd (pathname) ls rlogin ahto@berta.ioc.ee finger 5. Editors vi screen editors 6. Backing Up 7. Different WINDOWS systems SUNView Open Windows Xwindows anna login:Xwin password:tarkvara :startx xterm shell console

More Related