You are on page 1of 32

Common Mistakes:

➢ Motivation is not clear: Big Integer, Tank, ...

➢ Only a subset of a general programming language (e.g. C/C++ or Java).

➢ More like Application Programming Interfaces (APIs), rather than a new


computer language.

➢ Phrase structure of the proposed language is too simple to utilize


compiling techniques, e.g. Video and Audio Management.

➢ A motivating example is the best way to reveal the characteristics of your


language.

~ 1 ~
~ 2 ~
~ 3 ~
Common Mistakes:

➢ Two stages of bootstrapping are not merged to a single T diagram.

~ 4 ~
~ 5 ~
Common Mistakes:

➢ The root of the parse tree is not the start symbol of the grammar.

➢ Some terminals are missed in the parse tree, usually the epsilon, an
operator and a parenthesis.

~ 6 ~
Common Mistakes:

➢ Swap the position of symbols in a production, e.g: "bexpr -> bexpr or


bterm" is written "bexpr -> bterm or bexpr".

~ 7 ~
Common Mistakes:

➢ Misunderstand the general approach to judge whether a given grammar is


ambiguous.

~ 8 ~
Common Mistakes:

➢ Comments are considered as tokens.

➢ Merge operators and punctuation into one class.

➢ List the classification and set of tokens, but not the sequence of tokens.

~ 9 ~
~ 10 ~
Common Mistakes:

➢ Use inappropriate partial enumeration of language a*ba*ba*ba*, e.g {bbb,


abbb, ababb, ababab, abababa, aabbb, aababb, aababab, aabababa,
aabaabb, ...}

~ 11 ~
~ 12 ~
Common Mistakes:

➢ Do not specify the corresponding NFA states of a DFA state when


converting an NFA to DFA.

➢ Do not strictly follow the Thompson Construction algorithm of transfering a


regular expression to an NFA.

~ 13 ~
~ 14 ~
~ 15 ~
Common Mistakes:

➢ Over-specification: illegal strings are recognized in the DFA.

~ 16 ~
~ 17 ~
Common Mistakes:

➢ No error reporting actions when syntax error arises.

➢ Do not define the behavior of match() function.

➢ Redundant arrow pointing to the start state of the transition diagrams.

➢ Give a parse tree (or match/derive sequence) instead of procedure call


sequence.

~ 18 ~
~ 19 ~
~ 20 ~
Common Mistakes:

➢ Misunderstand the conditions for predictive parsing.

~ 21 ~
Common Mistakes:

➢ Missing $ in the FOLLOW set.

~ 22 ~
Common Mistakes:

➢ Redundant '$' in FOLLOW(L') when there is a production L' -> ,SL' | eps ,
and S is the start symbol.

~ 23 ~
~ 24 ~
Common Mistakes:

➢ Cannot explain why a grammar is not LL(1).

➢ Mix the definition of non-LL(1) grammar and ambiguious grammar.

~ 25 ~
~ 26 ~
Common Mistakes:

➢ Try to eliminate Left-Recursion with an OPP grammar.

➢ Misunderstand the concept of Left-Most Prime Phrases, which leads to


many kinds of wrong answers.

~ 27 ~
~ 28 ~
~ 29 ~
~ 30 ~
~ 31 ~
~ 32 ~

You might also like