{June 6, 2015}   Tsu Chi-Pertemuan 4

Comunity Program


Name: Kesia Anastashella

NIM : 1801436713



It occured on 5 June, we do the same glasses again like last attendance.


Oh well we didnt take much photo today :) but this time the variant of the glasses are epic, from tiny, small, medium, and big and we decided to separate all.

Glad we finally managed to finish this job hahahaha :)))

{June 6, 2015}   Tsu Chi- Pertemuan 3

Comunity Program


Name: Kesia Anastashella

NIM : 1801436713


Our third attendance is at 8 May and this time we do glasses instead of bottle. And today i bring gloves to cover my hand because last time my allergic comes out and i got rashes due to the dirty bottles :(

20150508_53720150508_462320150508 #1_21220150508_401620150508_2139

because it can be stacked, its easier for us to arrange the glasses that is done to the plastic :D we do total of 3 boxes of glasses, and 1 bag of glasses, and the result is only 1 bag of glasses stacked :o!

Its easier to do these glasses :D

{June 6, 2015}   Tsu Chi – Pertemuan 2

Comunity Program


Name: Kesia Anastashella

NIM : 1801436713


We’re back at the Tsu Chi Recycling place at 17th april! its on friday and today we still doing the same bottles 2015037_42020150508 #1_2015

We have to separate colourful bottles with those transparent bottles.

{March 27, 2015}   TFI – Tsu Chi Pertemuan 1

Comunity Program


Name: Kesia Anastashella

NIM : 1801436713


Hellooo everyone :3 Here are some boring blog post from me ( im not a pro for making things like this.. blogging blah :< sorry )

But anyway,

On Friday, 27 March 2015, some of our team, Anton, Fery, Chrisando (we call him icep!), Me, and Tiffany, went to ‘Tsu Chi’ at Tangerang to recycle many, many, really many plastic bottles. Each of us have 1 big bag of bottles that are needed to be sorted according to the bottle’s color and the bottle cap’s color. We sit at the small chair and start to do our duty by peeling off the plastic brand, open the cap, take the circle thing at the bottle neck, then crush it either with our hand or feet. We did this with the hot, timid, raining day.. and..our friendly vampire, mosquitoes! :(asdfasdfdsfasdfasdfasdf

Although its.. dirty.. and .. quiet often we found mildew inside the bottle and guess what, IT SMELLS AWESOME!!!!!! *sarcastic tone.

Oh well even though its like that, we did this while chatting and gossiping and just, have fun with our work. When we done, our fingers are really really black and dirty. We wash our hand, then we leave the place with our wet clothes (because it was raining like mad hahaha)

Lucky today we go back without anyone getting injured. Last week (i didn’t attend but my friend told me), that someone was injured because they are not familiar yet with the tools hahahaha

Next week probably we will continue our job, since at that place, still got SOOOOO many bottles that is needed to be sorted. We are happy that we can help making this world better (maybe only a small job) but at least we do something. Wanna join us? :)

{December 16, 2014}   Chapter 8-PLC


  1. What is the definition of control structure?
  •  A control structure is a control statement and the collection of statements whose execution it controls.
  1. What did Bohm and Jocopini prove about flowcharts?
  • It was proven that all algorithms that can be expressed by flowcharts can be coded in a programming languages with only two control statements: one for choosing between two control flow paths and one for logically controlled iterations.
  1. What is the definition of block?
  •  In Ruby, block is a sequence of code, delimited by either breves or the do and and reserved words.
  1. What is/are the design issue(s) for all selection and iteration control statements?
  • Selection

Two-way :

  • What is the form and type of the expression that controls the selection ?
  • How are the then and else clauses specified ?
  • How should the meaning of nested selectors be specified ?

Multiple-Selection :

  • On which type the selector is based ?

Iteration :

  • How is the iteration controlled ?
  • Where should the control mechanism appear in loop statement?
  1. what are the design issues for selection structures?
  • What is the form and type of the expression that controls the selection ?
  • How are the then and else clauses specified ?
  • How should the meaning of nested selectors be specified ?

Problem set:

  1. Describe three situation where a combined counting and logical looping statement is needed.
  • A list of values is to be added to a SUM, but the loop is to be exited if SUM exceeds some prescribed value.
  • A list of values is to be read into an array, where the reading is to terminate when either a prescribed number of values have been read or some special value is found in the list.
  • The values stored in a linked list are to be moved to an array, where values are to be moved until the end of the linked list is found or the array is filled, whichever comes first.
  1. Study the iterator feature of CLU in Liskov et al. (1981) and determine its advantages and disadvantages

The key addition was the concept of a cluster, CLU’s type extension system and the root of the language’s name CLUster. Clusters correspond generally to the concept of an “object” in an OO language, and have roughly the same syntax.

CLU did not offer any sort of structure for the clusters themselves. Cluster names are global, and no namespace mechanism was provided to group clusters or allow them to be created “locally” inside other clusters. This problem is not unique to CLU, but it is surprising that so many languages have lacked this feature — given the centralness in ALGOL of giving scope to variables, it seems that giving scope to cluster/object names would be an obvious extension.

CLU does not perform implicit type conversions. In a cluster, the explicit type conversions ‘up’ and ‘down’ change between the abstract type and the representation. There is a universal type ‘any’, and a procedure force[] to check that an object is a certain type.

Another key feature of the CLU type system are iterators, which return objects from a collection one after the other. Iterators were “black boxes” that offered an identical API no matter what data they were being used with. Thus the iterator for a collection of complex_numbers would be identical to that for an array of integers.

CLU also includes exception handling, based on various attempts in other languages; exceptions are raised using signal and handled with except. Oddly, given the focus on type design, CLU does not offer enumerated types, nor any obvious way to create them.

A final distinctive feature in CLU is multiple assignment, where more than one variable can appear on the left hand side of an assignment operator

  1. Compare the set of Ada control statements with those of C# and decide which are better and why.
  • C# because the C# multiple selection structures is a great boost to C# writability, with no obvious negatives, furthermore C# control statement is the most flexible iteration statement.
  1. What are the pros and cons of using unique closing reserved words on compound statements?
  • Unique closing keywords on compound statements have the advantage of readability and the disadvantage of complicating the language by increasing the number of keywords.
  1. What are the arguments, pro and con, for Python’s use of indentation to specify compound statements in control statements?

Pros of indentation:

  • Helps reduce inconsistent indentation in code which makes it easier to read (in other words consistency)
  • clears the screen by replace visible tokens with whitespace to serve the same purpose

Cons of indentation

  • Much easier to cut and paste code to different levels (you don’t have to fix the indentation)
  • More consistent. Some text editors display whitespace(s) differently.
  • You cannot safely mix tabs and spaces in Python such that it would be easy to cause an error by putting too few spaces in an indentation level, thus going to the previous indentation level and closing the loop/block. This decreases writability.

Chapter 6 : Review Question

1. What is a descriptor?

= Descriptor is the collection of the attributes of a variable.

2. What are the advantages and disadvantages of decimal data types?

= The advantages of decimal data types is being able to precisely store decimal values, at least those within a restricted range, which can’t be done with floating-point. And the disadvantages of decimal data types are that the range of values is restricted because no exponents are allowed, and their representation in memory is mildly wasteful.

3. What are the dessign issues for character string types?

= The two most important design issues that are specific to character string types are the following :

– Should strings be simply a special kind of character array or a primitive type?

– Should strings have static or dynamic length?

4. Describe the three string length options.

= – Static length string: the length can be static and set when the string is created.
– Limited dynamic length strings: allow strings to have varying length up to a declared and fixed maximum set by the variable’s definition.
– Dynamic length strings: allow strings to have varying length with no maximum.

5. Define ordinal, enumeration, and subrange types.

= – Ordinal type is one in which the age of possible values can be easily associated with the set of positive integers. In Java, for example, the primitive ordinal types are integer, char, and Boolean.
– Enumeration and subrange are the two user-defined ordinal type that have been supported by the programming languages.
– Enumeration type is one in which all of the possible values, which are named constants, are provided, or enumerated, in the definition. Enumeration types provide a way of defining and grouping collections of named constants, which are called enumeration constants.
– Subrange type is a contiguous subsequence of an ordinal type.

Chapter 6 : Problem Set

1. What are the arguments for and against representing Boolean values as single bits in memory?

= Boolean variables stored as single bits are very space efficient, but on most computers access to them is slower than if they were stored as bytes.

2. How does a decimal value waste memory space?

= Decimal types are stored very much like character strings, using binary codes for the decimal digits. These representations are called binary coded decimal (BCD). In some cases, they are stored one digit per byte, but in others, they are packed two digits per byte. Either way, they take more storage than binary representations. It takes at least four bits to code a decimal digit. Therefore, to store a six-digit coded decimal number requires 24 bits of memory. However, it takes only 20 bits to store the same number in binary.

3. VAX minicomputers use a format for floating-point numbers that is not the same as the IEEE standard. What is this format, and why was it chosen by the designer of the VAX computers? , A reference for VAX floating-point representation is Sebesta (1991).

= The existing DEC VAX formats, inherited from the PDP-11, because The PDP-11 had several uniquely innovative features, and was easier to program than its predecessors through the additional general-purpose registers.

4.Compare the tombstone and lock-and-key methods of avoiding dangling pointers, from the point of view of safety and implementation cost.

= Tombstones take more memory, while lock-&-key requires add’l cpu time on each ptr assignment to copy key as well as pointer. Pointer arithmetic could overwrite key in the heap.

5. What disadvantage are there in implicit dereferencing of pointers, but only in certain contexts? For example, consider the implicit dereference of a pointer to a record in Ada when it is used to reference a record field.

= When implicit dereferencing of pointers occurs only in certain contexts, it makes the language slightly less orthogonal. The context of the reference to the pointer determines its meaning. This detracts from the readability of the language and makes it slightly more difficult to learn.

Review Question

1. What are the design issues for names?

The design issues for names, primarily, are “names case sensitive?” and ?are the special words of the language reserved words or keywords?”

2. What is the potential danger of case-sensitive names?

There are 2 potential danger of case-sensitive names which are the writability and readability due to the characteristics of the names which look alike where it’s actually different.

3. In what way are reserved words better than keywords?

Reserved words are better due to it’s ability to redefine meanings. Keywords can be rather confusing due to the fact that it may contain multiple intentions.

4. What is an alias?

In reality, alias is another name of something. In this case, the position where a variable can be used to access the same memory location like another variables. This way, the variables that also have access is called an alias.

5. Which category of C++ reference variables is always aliases?

Union types.

Problem Set

1. Which of the following identifier forms is most readable? Support your decision.

– SumOfSales

– sum_of_sales


sum_of_sales because in this identifier, sentence are properly spaced (” “) with “_” therefore making the identifier more readable for most people. It also defines the exact meaning of the function and also does not confuses reader.

2. Some programming languages are typeless. What are the obvious advantages and disadvantage of having no types in language?

Advantage : Being a typeless language makes it easier for programmer to code or write sloppy programs quickly without the need of proper definiton.

Disadvantage :

– The compiler has its own control over data and variables. Programmers may left clueless due to the fact that they have no control.

– Mis-assigning variables will not lead to an error and the compiler will not catch your mistake. It will simply do as it is told to do event if it is wrong.

– It will be harder to determine the true intention of the programmer. Therefore, supporting such programs (created in type-less language) is basically harder the types one.

3. Write a simple assignment statement with one arithmetic operator in some language you know. For each component of the statement, list the various bindings that are required to determine the semantics when the statement is executed. For each binding, indicate the binding time used for the language

= (C++)

int count;count = count + 5;

Possible types for count: set at language design time. Type of count: bound at compile time.
Set of possible values of count: bound at compiler design time. Value of count: bound at execution time with this statement. Set of possible meanings for the operator symbol ““:*bound at language definition time.*Meaning of the operator symbol “” in this statement: bound at compile time.
Internal representation of the literal “5”: bound at compiler design time.

4. Dynamic type binding is closely related to implicit heap-dynamic variables. Explain this relationship.

The two are closely related to assignment and statement.

5. Describe a situation when a history-sensitive variable in a subprogram is useful.

History sensitive variables will help a lot in data manipulation. The function will be able to be called again after operations are performed on a variable, it exits. It will simply return the variable so the function doesn’t have to take the variable in as a parameter.

Review Question:

1.  What are three reasons why syntax analyzers are based on grammars?

-Using BNF descriptions of the syntax of programs are clear and concise.

-Can be used as the direct basis for the syntax analyzer.

-Implementations based on BNF are relatively easy to maintain because of their modularity.

2. Explain three reasons why lexical analysis is separated from syntax analysis.

–       Simplicity (Techniques for lexical analysis are less complex than those required for syntax analysis)

–       Efficiency (Although it pays to optimize the lexical analyzer, because lexical analysis requires a significant portion of total compilation time)

–       Portability (Because the lexical analyzer reads input program files and often includes buffering of that input, it is somewhat platform dependent)

3. Define lexeme and token.

Lexeme is the logical groupings that the lexical analyzer collects characters into and Token is the internal codes for categories of these groupings.

5. Describe briefly the three approaches to building a lexical analyzer.

–       Write a formal description of the token patterns of the language using a descriptive language related to regular expression.

–       Design a state transition diagram that describes the token patterns of the language and write a program that implements the diagram.

–       Design a state transition diagram that describes the token patterns of the language and hand-construct a table-driven implementation of the state diagram.


1. Perform the pairwise disjointness test for the following grammar rules.

a. A → aB | b | cBB
b. B → aB | bA | aBb
c. A → aaA | b | caB

(a) FIRST(aB) = {a}, FIRST(b) = {b}, FIRST(cBB) = {c}, Passes the test

(b) FIRST(aB) = {a}, FIRST(bA) = {b}, FIRST(aBb) = {a}, Fails the test

(c) FIRST(aaA) = {a}, FIRST(b) = {b}, FIRST(caB) = {c}, Passes the test

3. Show a trace of the recursive descent parser given in Section 4.4.1 for the string a + b * c.

a + b * c
Call lex /* returns a */
Enter <expr>
Enter <term>
Enter <factor>
Call lex /* returns + */
Exit <factor>
Exit <term>
Call lex /* returns b */
Enter <term>
Enter <factor>
Call lex /* returns * */
Exit <factor>
Call lex /* returns c */
Enter <factor>
Call lex /* returns end-of-input */
Exit <factor>
Exit <term>
Exit <expr>

5. Given the following grammar and the right sentential form, draw a parse tree and show the phrases and simple phrases, as well as the handle.

S → aAb | bBa  A → ab | aAb  B → aB | b

a. aaAbb

b. bBab

c. aaAbBb

Screen Shot 2013-03-27 at 6.20.39 PM
Screen Shot 2013-03-27 at 6.21.01 PM

Review Question

1. Define syntax and semantics

Syntax is form of expressions, statements and program units in a programming language. Semantics is the meaning of the expressions, statements and program units in a programming language.

2. Who are language descriptions for?

Language descriptions are for initial evaluators, implementors, and users.

3. Describe the operation of a general language generator.

Language generators create the strings of a Language. Generators are string constructors. A generator provides a construction description. If a generator is able to construct all strings in a Language L, and every string S that can be constructed by that generator is in L, we can say that the generator is for the Language L. If the generator cannot construct a string S from it, then S is not in L.

4. Describe the operations of a general language recognizer

A general language recognizer is a recognition device capable of reading strings of characters from the alphabet. It would analyze the given string and it would either accept or reject the string based from the language given. These recognition devices are like filters separating correct sentences from those that are incorrectly.A recognizer is used in the syntax analysis part of the compiler. In this role, the recognizer need not test all possible strings of characters from some set to determine whether each is in the language. The syntax analyzer just determines whether the given programs are syntactically correct.

5. What is the difference between a sentence and a sentential form?

A sentence is a sentential form that has only terminal symbols. A sentential form is every string of symbols in the derivation.

Problem Set.

1. The two mathematical models of language description are generation and recognition. Describe how each can define the syntax of a programming language.

= syntax error refers to an error in the syntax of a sequence of which is written in a particular programming language.
Semantic Error: it is a logical error. it is due to wrong logical statements

2. Write EBNF descriptions for the following:a.

A. Java class definition header statement

= <class_head> ® {<modifier>} class <id> [extends class_name] [implements<interface_name> {, <interface_name>}] <modifier> ® public | abstract | final<class_head> ® {<modifier>} class <id> [extendsclass_name] [implements<interface_name> {, <interface_name>}] <modifier> ® public | abstract | final

B. A Java method call statement

= <for> -> for ‘(‘ [[<type>] <id> = <expr> {, [<type>] <id> = <expr>}] ; [<expr>] ; [<expr>{, <expr>}] ‘)’ ‘{‘ <stmt_list> ‘}’

C. A C switch statement

= <stmt>    ->   switch ( <int expr> ) {

case <int const> :  { <stmt> ; }

{ case <int const> :  { <stmt> ; }}

[ default :  { <stmt>  ;  } ]


D. A C union definition

= <union_defn> -> union <var_list> <union_identifier>;

<var_list> -> <list_of_data-type specifier> <var>

<list_of_data-type specifier> -> int | float | long |char | double

<union_identifier> -> <var>

E. C float literals

= <float-literal> –>   <real> <suffix>

| <real> <exponent> <suffix>

| <integer> <exponent> <suffix>

3. Rewrite the BNF of Example 3.4 to give + precedence over * and force + to be right associative.

= <assign> -> <id> = <expr>

<id> -> A | B | C

<expr> -> <expr> – <term>

| <term>

<term> -> <term> / <factor>

| <factor>

<factor> -> ( <expr> )

| <id>

4. Rewrite the BNF of Example 3.4 to add the ++ and — unary operators of Java.

= <assign> -> <id> = <expr>

<id> -> A | B | C

<expr> += <term>

| <term>

<term> *= <factor>

| <factor>

<factor> -> ( <expr> )

| <id>

5. Write a BNF description of the Boolean expressions of Java, including the three operators &&, ||, and ! and the relational expressions.

= <Boolean_expr> → <Boolean_expression> ||<Boolean_term> | <Boolean_term>

<Boolean_term> → <Boolean_term> && <Boolean_factor> | <Boolean_factor>
<Boolean_factor> → id | ! <Boolean_factor> | (<Boolean_expr>) | <relation_expr>
<relation_expr> → id == id | id !=id | id < id | id <= id| id >= id | id > id

Review Question

1. In what year was Plankalkül designed? In what year was that design published?

Plankalkül was designed by Konrad Zuse in 1945 but it isn’t published until 1972.

2. What two common data structures were included in Plankalkül?

arrays and records

3. How were the pseudo codes of the early 1950s implemented?

They were implemented through machine codes.

4. Speedcoding was invented to overcome two significant shortcomings of the computer hardware of the early 1950s. What were they?

The two significant shortcomings of the computer hardware are Pseudo-instructions and novel facility of automatically incrementing address registers.

5. Why was the slowness of interpretation of programs acceptable in the early 1950s?

The lack of floating-point hardware in the available computers.

Problem Set

1. What features of Plankalkül do you think would have had the greatest influence on Fortran 0 if the Fortran designers had been familiar with Plankalkül?

The loop feature control statement and the selection (if/else) statement

2. Determine the capabilities of Backus’s 701 Speedcoding system, and compare them with those of a contemporary programmable hand calculator.

The capabilities of Backus’s 701 Speedcoding system :
– As few instructions as possible should be required to specify a program. Programming time should be minimized.
– Programs should be easy to check out.
– Scaling should be unnecessary.
– Address modification should be made very convenient.
– Transfer of arbitrary blocks of information to and from high-speed storage should be easy to specify.
– Common functions should be readily available.
– Optional automatic checking of calculations should be provided.

3. Write a short history of the A-0, A-1, and A-2 systems designed by Grace Hopper and her associates.

A-0 was the first compiler ever developed for an electronic computer. The A-0 system was followed by the A-1, A-2, A-3, AT-3 and B-0. The A-2 system was developed at the UNIVAC division of Remington Rand in 1953 and released to customers by the end of that year. Grace Hopper is a hero.

4. As a research project, compare the facilities of Fortran 0 with those of the Laning and Zierler system.

The effect of the Laning and Zierler system on the development of Fortran is a question which has been muddled by many misstatements on my part. I believed that we had gotten the idea for using algebraic notation in Fortran from seeing a demonstration of Laning and Zierler system at MIT.

5. Which of the three original goals of the ALGOL design committee, in your opinion, was most difficult to achieve at that time?

a reference syntax, a publication syntax, and an implementation syntax.

et cetera

Get every new post delivered to your Inbox.

Join 346 other followers