Monday, June 3, 2019

Low Level Programming Language Computer Science Essay

pathetic Level Programming Language Computer science EssayLow-level program language is a programming language that provides little or no synopsis from a computers instruction set architecture. The forge low refers to the small or nonexistent amount of abstraction between the language and machine language beca recitation of this, low-level languages atomic number 18 few time described as being close to the hardware.A low-level language does not need a writer or interpreter to run. The mathematical butt onor for which the language was written is adequate to run the principle without using either of these.By comparison, a high-level programming language isolates the execution semantics of computer architecture from the specification of the program, making the process of developing a program simpler and more understandable.Low-level programming languages are sometimes divided into two categories first generation, and second generation.First generationThe first-generation pr ogramming language, or 1GL, is a machine label. It is the alone language a microprocessor net process instantly without a previous transformation. Currently, programmers almost never write programs directly in machine code, because it requires attention to numerous details which a high-level language would handle automatically, and also requires memorizing or looking up numerical codes for each instruction that is used. For this reason, second generation programming languages provide one abstraction level on top of the machine code.Example A function in 32-bit x86 machine code to calculate the nth Fibonacci number8B542408 83FA0077 06B80000 0000C383FA027706 B8010000 00C353BB 01000000B9010000 008D0419 83FA0376 078BD98BC84AEBF1 5BC3Second generationSecond-generation programming language, or 2GL, is an assembly language. It is considered a second-generation language because while it is not a microprocessors native language, an assembly language programmer must still understand the microprocessors unique registers and instructions. These simple instructions are thence assembled directly into machine code. The assembly code pile also be oblivious to an another(prenominal) layer in a similar manner as machine code is abstracted into assembly code.Example The same Fibonacci number calculator as on page one, but in x86 assembly language using MASM syntax tommyrotmov edx, esp+8cmp edx, 0ja fmov eax, 0retcmp edx, 2ja fmov eax, 1retpush ebxmov ebx, 1mov ecx, 1lea eax, ebx+ecxcmp edx, 3jbe fmov ebx, ecxmov ecx, eax declination edxjmp bpop ebxretHigh level programming languageHigh-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, it is easier to use and more portable across platforms. Such languages suppress the details of CPU operations such as memory access models and management of scope.This greater abstraction and hiding of details is generally intended to ingest the language user-friendly, as it accepts c at one timepts from the problem domain instead of those of the machine used. A high-level language isolates the execution semantics of computer architecture from the specification of the program, making the process of developing a program simpler and more understandable with respect to a low-level language. The amount of abstraction provided defines how high-level a programming language is.The call high-level language does not imply that the language is superior to low-level programming languages in fact, in terms of the depth of knowledge of how computers work require to productively program in a given language, the inverse may be true. kinda, high-level language refers to the higher level of abstraction from machine language. Rather than dealing with registers, memory addresses and call stacks, high-level languages deal with usability, threads, locks, objects, variables, arrays an d complex arithmetic or Boolean expressions. In addition, they oblige no opcodes that preserve directly gather the language into machine code, un alike low-level assembly language. Other features such as string handling routines, object-oriented language features and file input/output may also be present.High-level languages make complex programming simpler, while low-level languages tend to produce more efficient code. High-level programming features like more generic selective information structures, run-time interpretation and intermediate code files often result in slower execution speed, higher memory consumption and big binary size. For this reason, code which needs to run particularly quickly and efficiently may be written in a lower-level language, even if a higher-level language would make the coding easier.With the growing complexity of modern microprocessor architectures, well-designed compilers for high-level languages frequently produce code comparable in capacity to what most low-level programmers can produce by hand, and the higher abstraction may allow for more powerful techniques providing better overall results than their low-level counterparts in particular settings.There are three models of execution for modern high-level languagesInterpreted Interpreted languages are read and then executed directly, with no compilation stage.Compiled Compiled languages are transformed into an viable form before running. There are two pillow slips of compilation Intermediate map outations When a language is compiled to an intermediate representation, that representation can be optimized or salvage for later execution without the need to re-read the source file. When the intermediate representation is saved it is often represented as bytecode. Machine code generation Some compilers compile source code directly into machine code. Virtual machines that execute bytecode directly or transform it further into machine code have blurred the once clear di stinction between intermediate representations and truly compiled languages.Translated A language may be translated into a low-level programming language for which native code compilers are already widely available. The C programming language is a common target for such translators.Examples of high level programming language includeJava, C, Python, Scheme, Prolog, C++, C, VB, Java Script, Ruby and Lisp.Comparison of high and low programming languages below are similar programs in both languages to find sterling(prenominal) and smallest data value in a data set.Validating raw dataInput validation is an important part of any computer diligence that requires user interaction. It applies to anything that the application does to ensure that data entered by the user is acceptable for the purposes of the application.Input validation can take place at various times in the data entry cycle. For example, the programmer canConstrain the users entry of data before it begins by providing ver y restricted data input field that permit only valid choices. The most common way to do this is to provide standard controls that do not permit free keyboard entry, such as drop-down lists, option buttons, and check boxes.Constrain the users entry of data at the moment that it occurs by monitoring every keystroke for validity and rejecting unwanted input as its typed. For instance, a particular entry field might seem to the user to ignore anything but numeric characters.React to the users entry of data after the user is finished, pass judgment or rejecting the contents of a data field when the user attempts to leave the field or close the screen.Input validation can also have varying degrees of user participation. For instance, the program canAutomatically conciliate a users mistakes without asking the users opinion.Warn the user of incorrect input and prompt the user to correct the input before allowing the user to continue with other activities.Benifets of information Validatio n Reduces the time that is spent completing forms and eliminates costs associated with errors by validating data, improving efficiency and minimizing the high cost of exception handling resulting from data input errors. Validation happens immediately in a visual basic form and can snapshot common errors such as not entering a required field, incorrect data type or entering incorrect data base on other data previously entered into the form.Example validation of checking if the date entered is after todays datePrivate Sub Date_Entered_AfterUpdate() If Me.Date_Entereddate() then Date_Entered is form field construct msgbox Please enter a date less than or equal to todays date. Me.Date_Entered.setfocus set cursor back in the date field end if force out SubUsing strings with passwords in visual basicThe use of strings benefits data entry in a password application in visual basic because the program would not readjust itself and crash on error input. This could affect the safety of t he password which could be compromised.It compares the 4 digit meter inputted in order and will only allow access when all 4 characters are correct and in the right sequence. If this doesnt happen it will reset and wipe the numbers clear. This is so the imputer cannot see which ones he/she has got right and try different ones for the others remaining.In visual basic for the above program you could limit the user to a certain amount of attempts before the user is locked out. When the code is incorrect you could have a warning flash up on the computer, or if the handle sort of data is inputted you can have a warning asking for the correct data. Likewise if you have not inputted 4 digits it would crash so this can be modified in the code strings with .Data pillowcasesBoolean Data TypeThis data type holds values that can be only true or false. The keywords True and off-key correspond to the two states of Boolean variables. Use the Boolean data type to contain two-state values such a s true/false, yes/no, or on/off. The default value of Boolean is False.Type ConversionsWhen opthalmic raw material converts numeric data type values to Boolean, 0 becomes False and all other values become true. When Visual Basic converts Boolean values to numeric types, False becomes 0 and True becomes -1.When you convert between Boolean values and numeric data types, the .NET Framework conversion methods do not always produce the same results as the Visual Basic conversion keywords. This is because the Visual Basic conversion retains behaviour compatible with previous versions.Programming spendNegative Numbers. Boolean is not a numeric type and cannot represent a negative value. In any case, you should not use Boolean to hold numeric values.Type nigrifyacters. Boolean has no literal type character or identifier type character.Framework Type. The corresponding type in the .NET Framework is the system Boolean structure.In the following example, runningVB is a Boolean variable, wh ich stores a simple yes/no setting.Dim runningVB As Boolean Check to see if program is running on Visual Basic engine.If scriptEngine = VB ThenrunningVB = TrueEnd IfInteger Data TypeInteger data holds signed 32-bit (4-byte) integers ranging in value from -2,147,483,648 by dint of 2,147,483,647.The Integer data type provides optimal performance on a 32-bit processor. The other integral types are slower to load and store from and to memory. The default value of Integer is 0.Programming guideInterop Considerations. If you are interfacing with components not written for the .NET Framework, for example mechanisation or COM objects, keep in mind that Integer has a different data width (16 bits) in other environments.Widening. The Integer data type widens to Long, Decimal, Single, or Double. This means you can convert Integer to any of these types without encountering a System.OverflowException error.Type coalacters. Appending the literal type character I to a literal forces it to the In teger data type. Appending the identifier type character % to any identifier forces it to Integer.Framework Type. The corresponding type in the .NET Framework is the System.Int32 structure.If you try to set a variable of an integral type to a number outside the range for that type, an error occurs. If you try to set it to a fraction, the number is rounded. The following example shows this. The valid range of an Integer variable is -2147483648 through +2147483647.Dim k As Integer The following relation causes an error because the value is too large.k = 2147483648 The following statement sets k to 6.k = CInt(5.9)Char Data TypeHolds unsigned 16-bit (2-byte) code points ranging in value from 0 through 65535. Each code point, or character code, represents a single Unicode character.You use the Char data type when you need to hold only a single character and do not need the overhead of String. In some cases you can use Char(), an array of Char elements, to hold multiple characters. The d efault value of Char is the character with a code point of 0.Unicode CharactersThe first 128 code points (0-127) of Unicode correspond to the letters and symbols on a standard U.S. keyboard. These first 128 code points are the same as those the ASCII character set defines. The second 128 code points (128-255) represent special characters, such as Latin-based alphabet letters, accents, currency symbols, and fractions. Unicode uses the remaining code points (256-65535) for a wide variety of symbols, including worldwide textual characters, diacritics, and mathematical and technical symbols.You can use methods like IsDigit and IsPunctuation on a Char variable to determine its Unicode classification.Type ConversionsVisual Basic does not convert directly between Char and the numeric types. You can use the Asc, AscW Functions to convert a Char value to an Integer representing its code point. You can use the Chr, ChrW Functions to convert an Integer value to a Char having that code point.If the type checking switch (Option Strict Statement) is on, you must append the literal type character to a single-character string literal to identify it as the Char data type. The following example on page 8 illustrates this.Option Strict OnDim charVar As Char The following statement attempts to convert a String literal to Char. Because Option Strict is On, it generates a compiler error.charVar = Z The following statement succeeds because it specifies a Char literal.charVar = ZCProgramming guideNegative Numbers. Char is an unsigned type and cannot represent a negative value. In any case, you should not use Char to hold numeric values.Interop Considerations. If you are interfacing with components not written for the .NET Framework, for example Automation or COM objects.Widening. The Char data type widens to String. This means you can convert Char to String without encountering a System.OverflowException error.Type Characters. Appending the literal type character C to a single-charac ter string literal forces it to the Char data type. Char has no identifier type character.Framework Type. The corresponding type in the .NET Framework is the System.Char structureComparison table between Ladder Logic and Visual BasicLanguageLadder LogicVisual BasicSuitability for engineering applicationsHighMediumAvailabilityMediumHighUser friendlinessLowHighCost of softwareHighLowSize of codeLow (high compact)HighDifficulty of useMedium to HighEasyEase of programmingMediumUser has knowledge then low User has no knowledge then HighIdeal useMachine controlSimulationResourceswww.wikipedia.org, www.msdn.microsoft.com, www.fortran.com, visual basic help, www.visualbasic.freetubes.net, www.blueclaw-db.com

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.