|
|
||
| You are here: | ||
|
Languages, architecture, systems. networks, data representation, errors and utility programs
Key fact: Everything inside the computer hardware is expressed in binary machine code, everything.
Semantic and logical errors are the same thing.
As an SL candidate this is more than you really need to know. It's hard to discuss the function of an HLL translator without this context, however.
|
On this page: [ Syntax and Semantics | HLL Translators | Software development tools ] High-level language features are only important to the programmer , the user doesn't care which language is used as long as the product is user-friendly. Programmers usually write programs which are not commercially available, many users can get by with the common applications packages like word processors, databases, spreadsheets, etc. We should be able to distinguish syntax (the rules which govern the construction of a language) from semantics (the meaning of a language - which is not always literal). Thus "You are so right!" could be a political message as well as an expression of agreement depending upon the context. When we talk about the semantics of an HLL we refer to the meaning which we attach to program statements (ie what do they do ). The syntax of a high level language program has to be correct, otherwise the program which is supposed to translate it into binary machine code (compiler or interpreter) will refuse to do so (you'll soon discover this for yourself). Sometimes programmers get confused about what exactly they are trying to achieve and use a ( logically ) incorrect statement that is syntactically correct . This program can be executed by the computer but results in a logic or semantic error. A programming language, eg Java , is used to construct programs or applications. Internally, as we shall see, the language is translated into binary machine code that the computer works with. Languages like Java are designed for the convenience of programmers . What are computer languages? The hardware refers to the electronic circuitry and other physical components that carry out instructions . This process is automated by the CPU - a complex piece of hardware that is nevertheless just a machine. Software refers to the programs and data that it operates on. These are supplied by humans. There are two main types of computer language for writing computer programs:
The hardware runs only in machine code , usually represented (by us) as the 1's and 0's of binary code. The electrical circuits and magnetic storage devices which make up the computer can only recognise two states. Inside the hardware a computer program may look like this: 0001010011100110 Binary machine code is tedious for humans to work with and they tend to make lots of mistakes when trying to do so. The first step for computer engineers was to make codes (or mnemonics)which could stand for binary instructions thus ADD might correspond to the code for adding two numbers together, LDA might correspond to the for code fetching a number from memory (LoaDing the Accumulator). Thus a low level language might express the above as: LDA 2309 This language is also known as Assembly Language and there is a one-to-one correspondence with machine code. Of course, this is still not very easy to handle so the next step was the development of High Level Languages (HLL's). One HLL statement usually translates into many machine code statements, you might see something like: FOR X = 1 to 23 DO Which, believe it or not, is easier to understand when you are trying to develop computer software (programs). Some features of HLL's are:
Examples of HLL's There are said to be 2000 different high level computer languages so these are just a few examples from the mainstream: Early HLL's were FORTRAN (FORmula TRANslation language) which was intended for mathematical and scientific programming and COBOL (COmmon Business-Oriented Language) for developing business and data-processing applications. ALGOL (ALGOrithmic Language) was an early (1950's) attempt to introduce the concept of structured programming and eventually led to the development of C and so on to Pascal which are highly-structured block languages. The structure is (supposed to be) used by programmers to make the workings of the program clear to other programmers who may have to work in the same team or do maintenance. BASIC (Beginners All-purpose Symbolic Instruction Code) was introduced for microcomputers and, although poorly structured and often misused, gave many, many people an easy initial introduction to computer programming. Some other notable languages are: FORTH , LISP and Prolog . All of these languages are available (or have been at some time) in versions for microcomputers. More recently Object Orientated Languages , notably SMALLTALK , C++ and Java have taken the concepts of structured programming one stage further (but you'll learn about this in another part of the course). Only Higher Level students need to know the concepts associated with Object Oriented programming. The next wave may well be scripting languages such as PHP , Python and Javascript. Comparison of Compilers and Interpreters Compilers and interpreters are two types of program that translate High Level languages into binary machine code . Different programs operate in different ways - many compilers produce an assembly language stage. With the advent of Java as a cross-platform language the following distinctions become a little blurred. Your Java source code files are compiled (by the javac program) not to machine code for a specific platform but to an intermediate stage known as bytecodes . These bytecodes are then fed to an interpreter (the Java Virtual Machine) of which there are different versions for different types of computer. In the simpler world, Compilers and Interpreters take High Level language source codes and produce binary machine code for a specific platform.
In this section: [ DBMS | macros | CASE | HTML/Web page editors ] DBMS A DBMS ( Database Management System ) provides an interface which makes data access simple for both users and system developers. It provides the following key functions:
MACROS As an example consider a paragraph in MS Word that contains several sentences which you want to split into a list. You could record the following keystrokes using Tools|Macro |Record New Macro... Use Edit|Find to locate the first full stop (period) You can then assign the macro to a shortcut key (Alt-Ctrl-S, say) and quickly separate the required lines. CASE Because these are standard techniques they can be implemented in a software package. HTML Editors and Web page editors HTML (HyperText Markup Language) was developed as a way of exchanging documents between different computer systems. Commands or <tags> inserted into the original (source) documents are used to show special features. For example the a heading can have a tag <H3> at the beginning and another <\H3> at the end to show that it is a level 3 heading. Other tags determine font styles , colours , sizes: Other tags determine font <strong>styles</strong>, The computer program that interprets these tags is called a browser - you are probably using Internet Explorer, Mozilla Firefox or Safari if you are a Mac user. However, there are other browsers for other systems and the way the tags are interpreted will vary from browser to browser. Some systems can only show text or limited graphics so the common language HTML can only "suggest" what the browser/hardware should do. The people who compose HTML documents do not have total control over their appearance. For those interested a pretty substantial list is given on this site. Here is an excellent page for html and JavaScript tutorials . Some HTML tools are editors - these work directly with the code; a good free example is FirstPage from Evrsoft. [screenshot, opens in new window]. Other tools like FrontPage or Dreamweaver are webpage editors which use high level tools to set things like font size and colour - using these tools you may never need to see the html tags at all. [FrontPage screenshot, opens in new window]. Some allow both like DreamWeaver. [screenshot of Dreamweaver, opens in new window] Search engines http://webquest.sdsu.edu/searching/fournets.htm which features the Google search engine - one of the most popular, of course. For a full list of search engines and their features try: http://www.searchengineshowdown.com/features/ New search engines on the market have special requirements but can be useful for generic searches. The best of these at the time of writing is probably kartoo which requires Flash. Back to top of page Back to top of section Code Editors syntax highlighting - to help you spot syntax errors . Keywords are in a different colour for example. Also quoted strings are also coloured differently which makes it easier to spot when they haven't been terminated properly. Many of the screenshots above illustrate this feature (see, FirstPage for example). automatic indenting - this helps you get a smart layout and keep it after you have edited bits in or out. It's a pain to keep typing spaces by hand. auto-completion - common keywords or groups of them can be completed automatically by some code editors. If it's a library method , the editor may be able to remind you of the required parameters . This is in addition to the normal features you would expect of any editor - cut, copy, paste, find, replace etc. An IDE is an Integrated Development Environment which usually includes all the tools you need to develop applications such as:
An excellent example of such an editor for java is the NetBeans IDE (http://www.netbeans.org ) which is free. However, it is very demanding of resources (needs a lot of memory and disc space) and pretty hard for beginning programmers. [ screenshots of NetBeans, opens in new window ] An IDE helps the programmer by helping them to organise their code and to spot syntax errors quickly (using the syntax highlighting ). The debugger can be used to step through the code line by line and watch various identifier values change. Programmers can add their own specialist routines to the library which speeds up development of projects. BlueJ from http://www.bluej.org includes most of these features (not the GUI editor) and is also free but considerably easier to use and much less resource-hungry. You can see brief screenshots on the getting started with Java page.
related: [ Common core home | next: data represenation ] |
Topic 3.1 |
|
|
|||
|
Questions or problems related to this web site should be addressed to Richard Jones who asserts his right to be identified as the author and owner of these materials - unless otherwise indicated. Please feel free to use the material presented here and to create links to it for non-commercial purposes; an acknowledgement of the source is required by the Creative Commons licence. Use of materials from this site is conditional upon your having read the additional terms of use on the about page and the Creative Commons Licence. View privacy policy. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. © 2001 - 2009 Richard Jones, PO BOX 246, Cambridge, New Zealand; This page was last modified: May 31, 2009 |