50 likes | 139 Views
Why Computer Languages?. Compute are stupid . They do not “understand” things. They have to be told very precisely what to do. Natural language are ambiguous. “College Station’s largest ( quality ( free ) newspaper ) ”. Programming language are designed to be unambiguou s.
E N D
Why Computer Languages? • Compute are stupid. • They do not “understand” things. • They have to be told very precisely what to do. • Natural language are ambiguous. • “College Station’s largest (quality (free) newspaper)”.
Programming language are designed to beunambiguous. • They are defined precisely, by syntax and semantics. • The meaning of each program is defined precisely. • Associativity is defined, e.g., 2-3-4 means (2-3)-4. • Priority of Operators is defined, e.g., 2+3*4 means 2+(3*4).
High-Level Pascal Pgm Program Example: const x = 12; y = 30; var z: integer; begin z := x + y; end.
Assembly Program EXAMPLE CSECT Balr 12 , 0 Using Base 12 Base L 2 , X A 2 , Y ST 2 , Z BCR 15 , 14 X DC F ’12’ Y DC F ’30’ Z DS F END CSECT
Machine Code( Hexidecimal) 05C0 Balr 12 , 0 5820 C00E L 2 , X 5A20 C012 A 2 , Y • C016 etc. ST 2 , Z 07FE BCR 15 , 14 0000000C X DC F ’12’ 0000001E Y DC F ’30’ 00000000 Z DS F END EXAMPLE