Untitled
unknown
plain_text
2 years ago
3.3 kB
8
Indexable
Language evalutaion criteria: - Readibility/Wrietability: maintaining the code is important while improving the sw ○ Num of constructs-> if large usage of subsets increase -> readibility decrease ○ Fetaure multiplicity-> making a thing from many different ways -> makes it easier to write code ○ Opeator overloading-> it improves readibility since it is simplifiying things but hs to be used responsively ○ Control stuctures-> if a language does not include nice control structures it reduces readibility If execution doesnt like the flow of reading it then it can have poor readibility ○ Data structures-> C does not have boolean even tough it is very useful -> true/false represented by 1/0-> structure increases the readibility - Reliability: no bugs and error ○ Type checking: while assigning a 4 byte value to 1 byte value you get type error: char x; int y; x=y; -> x=char(y); #typecasting § Static type checking= manually processing the code -> does not affect runtime since it occures at compile time § Dynamic type checking= runtime environment will check whether there are errors -> it slows down runtime § Exception handling= some test cases can crash the program so add a section that when encountered an unexpected input that cause error shut down gracefully § Aliasing= having multiple referances to the same memory location-> char x; char p*;x='a'; print(x) p= 2x; p*='b' -> value of the variable changed § Readibility/writebility - Cost: ○ If a language is a very complex language, training the developer costs more ○ Execution cost ○ Reliability requires consecutive execution and much more depending on the job Languages has been evolved within its history. There are factors that affected the desing of the languages. Those are: - Computer/Device Architecture: ○ Von Newman Architecture= memory(where program&data&instuctions has been stored) + cpu(where execution happens) ○ Programming Methodologies= poweful scientific computers can be bought by certain places at the beginning. We write programs that process data -> data oriented approach -> object oriented approach IMPLEMENTATION METHODS Every operation has a binary representation and that are stored in the memory To accomplish memory -> cpu translation the methods are: - Compilation: High level language -compiler-> low level language. Compilers are consists of: Frontend of the compiler: ○ Lexical Analyzer/Scanner: reades ASCII text, certain parts are identified such as ifs and loops ○ Syntax Analyzer/Parser: it checks the items detected are in the correct order and checks the grammatical order ○ Semantic Analyzer: checks types or variables Backend of the compiler: ○ Intermediate code generator: syntactic details are ignored ○ Optimizer: transform the program into more faster form of it ○ Code generator: generate the code in the target language - Interpretation - Hybrid implementation: pyhton Describing a language: Syntax + semantics - Decribing the syntax: ○ Tokens: add token = + tADD, - tSUB, .., => tOPP ○ Token spellings (lexeme of token): lexeme is unique for a language +ASGN (if C) -> '=', (if pascal) -> ':=', tID->token identifier
Editor is loading...