Professional Documents
Culture Documents
Course Title:Programming Languages & Compiler- Lab Abdulrab Ali Bin Taleb :اسم الطالب
Homework #1
Instructor Name: Abdul Haseeb 435050452 :الرقم الجامعي
Date:03/05/2018 :الشعبة
Deadline: 14/03/2018 1438-1439 (II) :المجموع
is a formal language that specifies a set of instructions that can be used to produce various kinds of
output. Programming languages generally consist of instructions for a computer.
Compilers
Compilers were the first sort of translator program to be written. The idea is simple: You write the program,
then hand it to the compiler which translates it. Then you run the result.
Interpreters
An interpreter is also a program that translates a high-level language into a low-level one, but it does it at the
moment the program is run. You write the program using a text editor or something similar, and then
instruct the interpreter to run the program. It takes the program, one line at a time, and translates each line
before running it: It translates the first line and runs it, then translates the second line and runs it etc.
much more machine independent and more programmer-friendly. This includes features like improved
support for aggregate data types, and expressing concepts in a way that favors the programmer, not the
computer. A third generation language improves over a second generation language by having the computer
take care of non-essential details such as C .
are a way to classify programming languages based on their features. Languages can be classified
into multiple paradigms.Some paradigms are concerned mainly with implications for the execution
model of the language, such as allowing side effects, or whether the sequence of operations is
defined by the execution model.
1. JavaScript
2. Java
3. Python
4. Ruby
5. CSS
6. PHP
7. C++
8. C
9. Shell
10. C#
11. Objective-C
12. R
13. VimL
14. Go
15. Perl
16. CoffeeScript
17. TeX
18. Scala
19. Haskell
20. Emacs Lisp
7. What arguments can you make for the idea of a single language for all programming
domains?
It’s a great idea to have a generalised programming language for any type of programming. It would make
both developer and users understand about the language deeper since there are no longer any additional
hustle in understanding another language for each cases. It would also make programs made under the
same language compatible one another and so there are no ports needed on different platform.
9. In a program reading user input using a Scanner, if the user types the following line of input:
How many tokens are in the preceding line? What types can the Scanner legally read each
token as?
10 Tokens:
Token1: Hello
Tokens2: There.
Tokens3: 3+4
Tokens4: Is
Tokens5: 7
Tokens6: and
Tokens7: 2.5
Tokens8: squared
Tokens9: Is
Tokens10: 5!
10. What are the three most fundamental models in compiler design and how they are used?
2. regular expression:
regular expression are patterns used to match character combinations in strings.
3. context-free grammar:
A context-free grammar is a grammar which satisfies certain properties. In computer
science, grammar describe languages; specifically, they describe formal languages.
CS4321 – Homework #1 Page: 3 of 4
CS4321 – Homework #1 Page: 4 of 4