You are on page 1of 13

NORTH SOUTH UNIVERSITY

DEPARTMENT OF ELECTRICAL & COMPUTER ENGINEERING

Assignment-3

Spring 2021
CSE425: Concepts of Programming Language
Section: 04

Name: Foyez Ullah Kabir


ID: 1821095042
+
.

Language name: LSK (Learning School for


kids)

- The concept of this name came from “BYJUS” the learning app, it will
be used to teach high school kids basics of programming.

- Stripped down to the simplest PL possible.

Language type: OOP and Structured.

Language Application Domain: Teaching


Lecture 5: (Names, Bindings and Scopes)

Design issues for Names:

a) Are names case sensitive?


Answer: Yes, just like Python and most other languages, LSK is going to
be case sensitive. This is so that students can learn to name their
variables according to their needs.

b) Are special words reserved words or keywords?


Answer: Yes, The language will have reserved words so that beginners don’t
mistake language tools as variables.

Design issues for Variables:

1. Name: Not all variables have names.


2. Address: Using pointers is allowed.
3. Value: Same as C and C++.
4. Type: Compile time, load time and runtime (static and dynamic) allowed.
Both implicit and explicit binding possible.
5. Lifetime: No Explicit heap-dynamic, Implicit heap-dynamic, Static,
Stack dynamic.
6. Scope: Static Scope, Let Construct, Global Scope, No dynamic scopes.
Lecture 6: (Data Types)

1. Primitive Data Types: Integer(int, long), Floating Point(float & double),


Boolean, Character

2. Character String Types: Both as

a) char arrays and a library of functions that provide operations( gives more
space to students to understand how arrays work as beginners).
b) Primitive type with assignment and several operations(can use this as
they get more advanced)

3. Array Types:
a) What types are legal for subscripts?
Answer: Use brackets

b) Are subscripting expressions in element references range checked?


Answer: Integer only

c) When are subscript ranges bound?


Answer: No specific range checking

d) When does allocation take place?


Answer: Initialization happens at the time of storage allocation.

e) Are ragged or rectangular multidimensional arrays allowed?


Answer: Both allowed.

f) Can array objects be initialized?


Answer: LSK follows Python’s array assignments, but they are only
reference changes. LSK also supports array catenation and element
membership operations same as python.

g) Are any kind of slices supported?


Answer: Yes, The LSK PL acts a lot like python in regards of
slices.

h) What is the maximum number of subscripts?


Answer: Access function maps subscript expressions to an address in the
array.

4. Record Types: Not allowed.


5. Tuple Types: Not allowed.

6. List Types: Not allowed.

7. Union Types: Not allowed.

8. Pointer and Reference Types: Uses the C++ form of pointers. So extremely
flexible. Used for dynamic storage management and addressing. Pointer
arithmetic is possible. Explicit dereferencing and address-of operators.

9. Type Checking: LSK is strongly, dynamically typed.

10. Type Equivalence: Not concentrated upon.

Lecture 7: (Expressions and Assignment Statements)


1. Operator precedence rules?
Answer: Follows typical precedence levels: Parentheses, unary
operators, (*, /), (+, -).

2. Operator associativity rules?


Answer: Left to right.

3. Order of operand evaluation?


Answer:
- Variables: fetch the value from memory.
- Constants: sometimes a fetch from memory; sometimes the constant is in
the machine language instruction.
- Parenthesized expressions: evaluate all operands and operators first.

4. Operand evaluation side effects?


Answer: The language definition is written so that it demands that operand
evaluation order be fixed.

5. Operator overloading?
Answer: Yes, allowed.

6. Type mixing in expressions?


Answer: Yes, allowed.

Lecture 8: (Statement-Level Control Structures)


Two-Way Selection Statements Design Issues:

1) What is the form and type of the control expression?

Answer: It must be Boolean.

2) How are the then and else clauses specified?

Answer: The control expression is placed in parentheses.

3) How should the meaning of nested selectors be specified?

Answer: Use compound statements.

Multiple-Way Selection Statements Design Issues:

1) What is the form and type of the control expression?

Answer: It can be only an integer type.

2) How are the selectable segments specified?

Answer: Selectable segments can be statement sequences, blocks, or compound


statements.

3) Is execution flow through the structure restricted to include just a single selectable
segment?

Answer: Any number of segments can be executed in one execution of the construct.

4) How are case values specified?

Answer: In a numeric integer order.

5) What is done about unrepresented expression values?

Answer: Default clause is used.

Counter-Controlled Loops control statements:

1) What are the type and scope of the loop variable?


Answer: There is no explicit loop variable.

2) Should it be legal for the loop variable or loop parameters to be changed in the loop
body, and if so, does the change affect loop control?

Answer: Everything can be changed in the loop.

3) Should the loop parameters be evaluated only once, or once for every iteration?

Answer: The first expression is evaluated once, but the other two are evaluated with
each iteration.

Logically-Controlled Loops Design Issues:

1) Pretest or posttest?

Answer: Both pretest and posttest available.

Lecture 9: (Sub programs)


A. Positional Correspondence: Not keyword because having to remember both
case and spelling is hard compared to only position.

B. Static Allocation: Dynamic Allocation is too hard for beginners to understand.

C. Allow subprogram definitions: Helps students understand nesting better.

D. What parameter passing methods are provided: Pass by value.

E. Type checking: allow type checking, makes spotting mistakes easier.

F. No arrays allowed to be passed as parameters.

G. Do not allow for Generic Subprograms.

H. Do not allow for closures.

I. Do not allow for Coroutines.

Lecture 11: (Abstract Data types)

A. Allow for abstractions like Java.


B. Do not allow generic classes.
C. Allow encapsulation like Java.
D. Inheritance like Java.

Issues with abstract Data types:

1. The Exclusivity of Objects.


- Selected method: Imperative-style typing system for primitives but make everything
else objects.
- Why not “Everything is an object” –Complicated syntaxes even for simple programs.
- Why not “complete typing system”- very confusing type system

2. Are Subclasses Subtypes?


Answer: A derived class is a subtype. The derived has an “is-a” relationship with its
parent class. This takes away a lot of the student’s freedom and makes them work
around, sharpening their minds in problem solving.

3. Single and Multiple Inheritance.


Answer: Multiple inheritance opens door for a lot of confusion to beginner programmers.
To just get used to the idea of inheritance, a single Inheritance system would make
more sense.

4. Object Allocation and Deallocation.


Answer: Heap-dynamic, references can be uniform through a pointer or reference
variables.
- Simplifies assignment and dereferencing can be implicit. Students don’t have to get
into a lot of details about how pointers for memory allocation works.

5. Dynamic and Static Binding.


Answer: All bindings have to be static only. Not bothered about efficiency of the
language at all since it’s aimed at teaching teenagers. No point in getting students
scared even before beginning to have fun.

6. Nested Classes.
Answer: Can be used in a subprogram, but not nested in itself.

7. Initialization of Objects.
Answer: Implicit initialization, don’t want students to get bothered with the syntaxes of
explicit initialization.

Lecture 12: (Concurrency)

1. The language is not going to have any Concurrency because it is designed for
students for whom the idea of threading would be very difficult to understand.
Evaluation Criteria

Readability:

Since BSS is simple, orthogonal and considers its syntaxes, it is a pretty readable
language. It would have been even better if it had more primitive constructs, but that
defeats the purpose of the PL.

i) Overall simplicity: LSK isn’t filled with a lot of features, so it’s simple.

ii) Orthogonality: only a handful of primitive constructs and every possible


combination is legal.

iii) Data types: Bare minimum number of predefined data types, but just enough to
get everything done.

iv) Syntax considerations: Predefined words are self-describing.

Writability:

BSS is simple and orthogonal and supports abstractions. It would have been more
writable if there were more predefined libraries.

(i)Simplicity and orthogonality: Few constructs and a small number of primitives used
only.

(ii)Support for abstraction: Yes

(iii)Expressivity: Not a lot of predefined libraries, users have to make up own


subprograms.
Reliability:

BSS isn’t the most reliable of languages. It lacks Exception handling and Aliasing. The
presence of good readability, writability and type checking makes it a moderately
reliable PL.

(i)Type checking: Allowed.

(ii)Exception handling: Missing.

(iii)Aliasing: Missing.

(iv)Readability and writability: Good.

Cost:

With most of its criteria’s met, the PL isn’t very expensive

(i)Training programmers to use the language: LSK has most of its common PLs like
C, Java and Python. It should be really easy to teach.

(ii)Writing programs: The program is designed to teach high school students


programming. It is very easy writing programs for solving problems of that level.

(iii)Compiling programs: Since the PL doesn’t have a very big library, it should be
easy to compile.

(iv)Executing programs: Executing programs don’t take a lot of time since it is worked
on existing fast PLs like python.

(v)Language implementation system: LSK should work on any Python compiler,


which has a lot of free compilers.

(vi)Reliability: The program is moderately reliable.

(vii)Maintaining programs: Since it doesn’t have a lot of functionality, it is very easy to


maintain the programs.

Portability: Programs written on LSK are very easy to be moved from one
implementation to another.
Generality: It is not general, because it has very limited functionality.

Well-definedness: It is a well-defined language.

You might also like