ParseIT: A Question-Answer based Tool to Learn Parsing Techniques

ParseIT: A Question-Answer based Tool to Learn Parsing Techniques


Parsing (also called syntax analysis) techniques cover a substantial portion of any undergraduate Compiler Design course. We present ParseIT, a tool to help students understand the parsing techniques through question-answering. ParseIT automates the generation of tutorial questions based on the Context Free Grammar provided by the student and generates feedback for the student solutions. The tool generates multiple-choice questions (MCQs) and fill in the blank type questions, and evaluates students’ attempts. It provides hints for incorrect attempts, again in terms of MCQs. The hints questions are generated for any correct choice that is missed or any incorrect choice that is selected. Another interesting form of hint generated is an input string that helps the students identify incorrectly filled cells of a parsing table. We also present results of a user study conducted to measure the effectiveness of ParseIT.

Intelligent Tutoring ; Education; Programming; Compilers; E-Learning


1 Introduction

Compiler design is an important subject in the computer science curriculum for undergraduates [8]. Compilers are one of the success stories of Computer Science, where sound theoretical concepts (e.g. Automata, Grammars, Graph Theory, Lattice Theory etc.) are backed by practical implementations (Lexical analyzers, Parsers, Code Optimizers etc.) to solve the real world problem of fast and resource-efficient compilation. Most existing compiler courses [2, 7, 6, 9] divide the curriculum into modules corresponding to the phases of compilation. Instructors discuss the theory in lectures while students typically work on a semester-long project implementing a compiler for some small language.

In a typical course, about 15%-22% of the total time is spent on syntax analysis phase (also called parsing techniques, see Table 1). A number of concepts are introduced to explain the internals of parsers, for example first sets, follow sets, item set, goto and closure sets, parse tables and the parsing algorithms [2], making the understanding difficult. While parser generators (YACC and its variants) allow the students to experiment with grammars, the working of the parser generated by the tools is still opaque1.

 Institute Course Name #/Duration of Lectures %
Parsing Total
 Stanford Intro. to Compilers [7] 4 18 22%
 IIT Kanpur Compiler Design [10] 6 35 17%
 Coursera Compilers [6] 4 modules 18 modules 22%
(4 hours) (19 hours) (21%)
 Saylor Compilers [9] 28 hours 146 hours 19%
Table 1: Time Spent on Teaching Parsing.

Recent development in technologies has enabled institutions to offer courses to large number of students. These massive-open-online courses (MOOCs) [5, 14, 19] digitize the contents of the topics (lecture videos, notes etc), and allow students to access the contents beyond physical boundaries of classrooms. The increase in number of students has added challenges for the instructor for the tutoring aspects, such as the creation of new problems for assignments, solving these problems, grading, and helping the students master a concept through hands-on exercises. These challenges have prompted researchers to develop automated tutoring systems to help the student to explore a course based on his skills and learning speed [3, 11, 21, 18, 15].

In this paper, we present ParseIT, a tool for teaching parsing techniques. ParseIT helps students to understand the parsing concepts through automatically generated problems and hints. Problems are generated based on a Context Free Grammar (CFG) given as input. The tool evaluates the solutions attempted by the user for these problems. Upon evaluation, if the solutions provided by the users are incorrect, it generates hint questions. The problems generated by the tool follow a general Multiple Choice Question (MCQ) pattern, where a user is given a problem with a set of possible choices, 1 or more of which are correct. The incorrect solutions are the ones where a correct option is not chosen, or an incorrect option is chosen, or both. The hints are generated in the forms of (simplified) questions to direct student toward the correct solution. Hint generation procedures involve different types of algorithms, of which the input string generation algorithm is notable. For an incorrect parse table provided by the user, this algorithm enables the creation of an input string that distinguishes a successful parse from an unsuccessful one.

We describe some of the systems developed by other for teaching compiler concepts in Sec. 2. The tool itself is described in Sec. 3. Input string generation algorithms for LL and LR parsers are given in Sec. 4. We present a summary of the user study in Sec. 5, and conclude in Sec. 6.

2 Related Work

Several efforts exist to automate teaching phases of compilers and to help developing a compiler as a course project. LISA [18] helps students learn compiler technology through animations and visualizations. The tool uses animations to explain the working of 3 phases of compilers, namely, lexical analysis, syntax analysis, and semantic analysis. Lexical analysis is taught using animations in DFAs. For syntax analysis, animations are shown for the construction of syntax trees and for semantic analysis, animations are shown for the node visits of the semantic tree and evaluation of attributes. Students understand the working of phases by modifying the specification and observing the corresponding changes in the animation.

Lorenzo et. al. [16] present a system for test-case based automated evaluation of compiler projects. Test cases (inputs and corresponding desired outputs) designed by the instructor are given as input to students’ compilers. The tool then assesses the compiler in three distinct steps–compilation, execution, and correction. The system automatically generates different reports (for instructors and students) by analyzing the logs generated at each of these steps.

Demaille et. al. [12, 13] introduce several tools to improve the teaching of compiler construction projects and make it relevant to the core curriculum. They made changes to Bison [4] to provide detailed textual and graphical descriptions of the LALR automata, allow the use of named symbols in actions (instead of $1, $2, etc.), and use Generalized LR (GLR) as backend. Waite [24] proposed 3 strategies for teaching compilers–software project, application of theory and support for communicating with a computer. Various other tools are also available to teach different phases of compiler like understanding code generation [22], and understanding symbol tables through animations [23].

Our work is different in that we use question-answering as means to explain the working of parsing technology and to guide the students towards the construction of correct parse table.

3 The ParseIT Tool

ParseIT takes as input a context free grammar and uses it as a basis for generating questions. These questions are in the form of MCQ 2 and deal with various concepts related to parsing. The normal workflow involves the following steps:

  1. The user provides an input grammar and the choice of topic. The topics refer to the concepts related to parsing such as FIRST set, FOLLOW set, LL Parsing Table, LL Parsing Moves, LR(0) Item-sets, SLR Parsing Table, SLR Parsing Moves, etc.

  2. A primary multiple choice question is generated based on the above two pieces of information.

  3. If the user answers the problem incorrectly, then hints are generated for the same question in the form of questions.

  4. When a correct solution to the problem is received, another question for the same topic is generated and presented to the user.

In the preprocessing step, the system takes a grammar as input and generates the information required for correct solutions. In particular, the tool generates the FIRST set and the FOLLOW set for all non-terminals, LL Parsing Table, LR(0) items, canonical set of items for SLR parser, and SLR parsing table.

For primary problem for the selected topic, ParseIT uses the data-structures to form MCQs having multiple correct answers. Users have to select all valid options, and no invalid option, for the answer to be deemed correct. The options are also generated using the preprocessed data.

In the answer evaluation step, the solution given by the user is compared with the solution computed by the tool in the preprocessing step. If the solutions match, then the control transfers back to the primary problem generation step to generate the next question. However, if the solution is wrong, the tool collects: a) the incorrect options which are selected, and b) the correct options which are not selected by the user and passes them to the hint generation step.3

For hints, ParseIT generates multiple hint questions for each of the incorrect choices. These questions are MCQs having a single correct choice. These questions help the user to revise the concept required to get correct solution to the primary question.

3.1 Problem Generation

Parsing techniques require solving three main types of problems: a) computation of sets of elements, for example, FIRST, FOLLOW, LR Items, GOTO, CLOSURE, b) computation of entries in a parse table, and c) steps of a parser on a given input string.

Since all the sets and tables are computed by ParseIT in the preprocessing step, generation of questions is easy. The details are given in a technical report [1]. For a question, the set of candidate choices is obtained by adding to the set of correct choices a few mutations (addition/removal of a term) or using a term from the solution for another similar problem. Evaluation of user solution is a simple comparison with the computed solution.

3.2 Hint Generation

ParseIT generates 2 types of hint questions to guide the user into reaching the correct solution of the primary problem and understanding her mistakes.

  • Hint_MCQ: Multiple choice questions are generated about the options selected by the user. These are typically generated when the user’s solution for a primary problem either contains an incorrect option or omits a correct option4. These help the user to understand that (a) the rules for the concept under test can not result in the particular incorrect option, and (b) the omitted option is a part of the correct solution and the rules that are used to get that option.

  • Hint_String: These types of questions are generated for filling LL/LR parsing tables of grammars having no conflicts (i.e., no duplicate entries in the cells). If the questioned cell of a parsing table is filled incorrectly, then the tool automatically generates an input string that exercises the contents of that cell during parsing. Due to incorrectly filled entry, the parsing with incorrect table for the string fails, thus hinting user that something is wrong with her solution.

Example 3.1

Consider the grammar:

one of the questions generated for FIRST set is:5

Question: Which symbols should be included in FIRST[T]?

Options: (a) 1 (b) 0 (c)

For a user selected symbol , the hint questions are necessarily generated if the selection is incorrect. Even for a correct answer, the hints questions are generated with some low probability. The hint questions are of the form:

HintQ: According to which of the following rules, the symbol is a part of FIRST[T]?

  1. If is a terminal, then FIRST() is .

  2. If is a nonterminal and is a production for some , then place in FIRST() if for some , FIRST(), and is in all ofFIRST(),…,FIRST(). If is in FIRST() for all , then add to FIRST().

  3. If is a production, then add to FIRST().

  4. No valid rule for this symbol.

If this hint question is asked for incorrect option (‘+’), the answer is option ‘4’. If a user selects any other option, the same question is repeated. For a correct option, say ‘0’, the expected answer is option ’2’.

After these hint questions, question is repeated. If it is answered correctly, then next question is generated. Otherwise, the above process is repeated.

Example 3.2

Consider the grammar:

The following question (Hint_MCQ) is generated for the entries of LL parsing table:

Question: Which grammar rule should be included in the cell of the parsing table? (A partially filled parse table is shown to the user.)

Options: (a) (b) (c) (d)

For a production selected by the user, the hint questions generated could be:

HintQ: According to which of the following rules, the production is in cell ?

  1. is production , and

  2. is production ,

Example 3.3

For the question of Example 3.2, The correct answer is (d) . if a user selects an incorrect choice, ParseIT can generate a string that will not be parsed correctly by the user’s parse table. Say the user selects choice (c) . ParseIT will generate string ab, and ask the hint question (Hint_String):

HintQ: LL-parsing on input ab with your parse table is failing. Can you fix the error by selecting the correct choice? (Parser movements shown to the user omitted for brevity)

Options: (a) (b) (c)

The most interesting feature of ParseIT is the generation of an input string to exercise incorrect entry in an incorrectly filled parse table. We describe this in brief.

4 Input String Generation

A parsing table is a two-dimensional array used to parse an input string. A grammar is considered LL/LR if the corresponding LL/LR parsing table has no duplicate entries. We generate hints of type Hint_String for grammars accepted by LL(0), LL(1) or SLR parsers. For simplicity, we assume at most one mistake (in some non-empty entry) in the table. If a non-empty cell of the parsing table is filled incorrectly by the user, then there exists a string accepted by the grammar that exercises the cell, but can not be parsed by the user filled (incorrect) parsing table. ParseIT generates such an input string. Then the corresponding question is to ask the user to parse the string using her incorrect table. The failure to parse the string serves as a hint that the table has errors in it.

4.1 Input String Generation for LL Parsing

ParseIT creates a graph  for the grammar as follows: All the symbols in the grammar appear as the vertices of the graph, edges are created from the symbol on the left side to each of the symbols on the right side of a rule. An edge is labeled with the shortest rule (i.e. the rule with the smallest number of symbols on the RHS) used for creating it. For each non-terminal, ParseIT also computes and records a terminal-only string derivable from that non-terminal. Terminal-only string for a terminal is itself.

Assume that, for the incorrectly filled cell, represents the row label (non-terminal) and represents the column label (terminal). Let be the start symbol of the grammar. We start with a string str1= and traverse  from start node (labeled ) to the node labeled on the shortest path. During traversal, the non-terminal corresponding to the source vertex in the string str1 is replaced by the label on the outgoing edge traversed. On reaching the node labeled , all symbols in str1, except last , are replaced by their terminal-only strings.

In the next step, the tool finds the shortest path from the node labeled to the node labeled . This path is traversed in the same way as described above to give a string str2. in str1 is replaced by str2 to get the final input string.

Note that the process described above is similar to constructing a parse tree, the difference being that we are creating the tree for an unknown string! The following example explains the algorithm.

E + T E |
T * F T |
F ( E ) | id
( ) id * + $
F F(E) Fid
T T  T T T
(a) Grammar.   (b) LL parsing table for the grammar.
(c) Graph for the example grammar. The shortest paths
(c) from to T and from T to are highlighted.
Figure 1: Input string generation for LL parsing.
Example 4.1

Consider the grammar in Fig. 1(a). The correct LL parsing table M for this grammar is shown in Fig. 1(b). Fig. 1(c) shows the graph generated by ParseIT for this grammar.

Suppose a user fills the cell M[T][)] incorrectly. In order to build the desired input string to exercise this cell, ParseIT will compute the shortest path from the start symbol E to T (the non-terminal representing the erroneous cell) using Dijkstra’s shortest path algorithm (Fig. 1(c)). The traversal of this path results in the following sequence of strings being generated:

Since the target non-terminal, T, is reached, all other non-terminals are replaced by their terminal-only strings (id for F and for E):

Next ParseIT finds the shortest path from T to ) (Fig. 1(c)), and expands it:

Non-terminals are replaced by terminal-only strings (E by id, T by ) to give the desired input string:

Note that T is not treated especially again as we have already taken care of exercising the desired entry, M[T][)].

4.2 Input String Generation for LR Parsing

The parse table for LR parsers consists of two sub-tables: Action table and Goto table [2]. The action table describes the interaction between a state in parsing and a terminal while the goto table describes the interaction between a state and a non-terminal. The action table has two types of entries: shift entries, that push a state on the parsing stack; and reduce entries that remove a certain number of states from the parsing stack. The entries in goto table are also shift entries (similar to those in the action table) in that they also push a state in the parsing stack.

Both types of shift entries look only at the top of the parsing stack and the current symbol (terminal or non-terminal) to decide the move. For reduce entries, on the other hand, the top few entries of the stack must match states corresponding to the right-hand side of a rule. As a result, the input string generation for LR parsing needs to setup the parsing stack properly and uses heuristics to pick appropriate reduce rules from the parse table to make sure that the parser stack is in accept state at the end of input.

Assume L denotes an LR parsing table,  represents the row label (state) and  represents the column label (non-terminal or terminal, including the special end marker $) for an incorrectly filled cell, L[][]. ParseIT computes a terminal-only string corresponding to each non-terminal, and a deterministic finite automaton (DFA) to recognize viable prefixes [2]. All the states corresponding to the item-sets containing item(s) with a dot at the end position are referred to as the reduce states of the DFA. The tool maintains a stack, a prefix string, and a set of possible next symbols.

Assume L denotes a LR parsing table,  represents the row label (state) and  represents the column label (non- terminal or terminal, including the special end marker $) for an incorrectly filled cell, L[][]. ParseIT computes a terminal-only string corresponding to each non-terminal, and a deterministic finite automaton (DFA) to recognize viable prefixes [2]. All the states corresponding to the item-sets containing item(s) with dot at the end position are referred to as the reduce states of the DFA. The tool maintains a stack, a prefix string, and a set of possible next symbols.

In the viable prefix DFA, a path from initial state, , to the state is traversed. Labels for the nodes (states) and the edges (terminal/non-terminals) along the path are pushed on the stack in the order in which they appear during traversal. The prefix string is generated by concatenating the edge labels traversed, and replacing every non-terminal by its terminal-only string. The next steps differs depending on the type of correct entry in the cell L[][].

Shift Entry

If the correct entry for L[][] is a shift entry (either in action or in goto sub-table), then, in the DFA, there will be an outgoing edge with label  from the node for state to a state . Symbol  is pushed onto the stack and its terminal-only string is appended to the partial input string. State is also pushed on the stack. A path is then found from to , one of the reduce states6. All the node labels and the edge labels along the path are pushed onto the stack in that order. The partial input string is appended with the terminal-only string for the path.

The column labels (symbols) corresponding to non-empty cells in row for in the parse table are added to the set of next symbol . The next action is performed on the set according to the following heuristics:

  • If row contains both shift and reduce actions: We chose reduce action over shift actions7. Any of the symbols in corresponding to the columns for reduce action can come next in the input string to force the reduction on stack. We differ the exact choice of symbol until we need to make a shift move (next point).

  • If row contains only shift actions: We compute the number of symbols between the dot and the end of RHS in each rule for each state. We choose to shift to the state having the smallest value. In case of tie, any of the states involved in the tie is chosen. Partial string is updated by concatenating the terminal-only string corresponding to the column label of the entry chosen for shift.

The stack is updated to reflect the action chosen. ParseIT keeps track of the choice made at this step to avoid using the same choice repeatedly. This is necessary to avoid generation of unbounded length input. The process is repeated until “accept” appears on top of the stack. At this point, the partial input string is the desired input. The following example illustrates these steps.

0) S S
1) S CC
2) C aC
3) C d
(a) Augmented
(a) Grammar
 I0: S S
C aC
C d
 I1: S S
 I2: S CC
C aC
C d
 I3: C aC
C aC
C d
 I4: C d
 I5: S CC
 I6: C aC
(b) Item sets
S Action     Goto
T a d $ S C
0 s3 s4 1 2
1 acc
2 s3 s4 5
3 s3 s4 6
4 r3 r3 r3
5 r1
6 r2 r2 r2
(c) LR Parse Table

(d) DFA for viable prefixes. Path from state 0 to 3 is highlighted.

Figure 2: Input string generation for LR grammar.
Example 4.2

Consider the augmented grammar in Fig. 2(a). The item-sets, the correct parse table, and the DFA for viable prefixes are shown in Fig. 2(b), (c) and (d) respectively. For the DFA, state 0 is the initial state and {1, 4, 5, 6} is the set of reduce states.

Suppose user makes an incorrect entry in the cell L[3][d], then the shortest path from state 0 to state 3 is traversed (Fig. 2(d)). From state 3, there is a transition on symbol d to state 4, which happens to a reduce state. The stack (), partial string (PStr), and set of potential next symbols (X) maintained by ParseIT at this stage are shown in Fig. 3(a).

The non-empty entries in the parse table for the row of state 4 (top of the stack) are considered for the next set of the terminal symbols. For this table, all entries are same (r3), so all of them are considered for application of reduced rule. Fig. 3(b) shows the configuration.

We repeat the process with state 6 on the top of the stack. In this case, the same columns have non empty entries (r2). So, there is no refinement in the choice of the next symbol, and the set X remains the same. The reduction results in the configuration Fig. 3(c).

Now state 2 is on top of the stack. The corresponding row contains non empty entries, s3 and s4, for columns labeled a and d. This restricts the choice for next symbol to {a, d} (Fig. 3(d)).

Using the heuristic to shift to a state where dot is closest to the right end of RHS of some rule, we prefer a shift to state 4 (Cd has at the right end, compared to C aC in state 3, where is 1 symbol away from the right end.) This forces the next symbol to be d. Since we have narrowed down the next symbol to a unique choice, the symbol is appended to the partial string and corresponding shift is made on the stack. Set X is cleared (Fig. 3(e)).

The process is continued till we get an “accept” on the stack. The remaining configurations for the example are shown in Fig. 3(f). The desired input string to exercise L[3][d] is partial string at this stage (ignoring the end-marker $), i.e. add.

  PStr X
 0a3d4 ad
  PStr X
 0a3d4 ad {a, d, $}
 0a3C6 ad
(a) (b)
  PStr X
 0a3d4 ad {a, d, $}
 0a3C6 ad {a, d, $}
 0C2 ad
  PStr X
 0a3d4 ad {a, d, $}
 0a3C6 ad {a, d, $}
 0C2 ad {a, d}
(c) (d)
  PStr X
 0a3d4 ad {a, d, $}
 0a3C6 ad {a, d, $}
 0C2 ad {a, d}
 0C2d4 add
  PStr X
 0C2d4 add {a, d, $}
 0C2C5 add {$}
 0S1 add$
 accept add$
(e) (f)
Figure 3: Configurations of ParseIT while generating string for incorrect shift entry for LR grammar.

Reduce Entry For generating input corresponding to a shift entry in a cell in the parse table (more precisely, in the goto or action sub-table), the state only at the top of parsing stack is important. For a reduce entry, however, the configuration of stack below the top also plays a vital role as the RHS of the rule, using which reduction takes place, must match the prefix at the top of the stack. Thus, input generation algorithm not only needs to construct the next symbols in the (unknown) string, but also the previous symbols that have been already pushed on the stack (and possibly undergone some reductions as well).

For an incorrect entry corresponding to the reduce entry in cell L[][], ParseIT generates the input for reduce entries in two stages: in the first stage, the stack is setup to enable the application of the desired reduce rule, i.e., the symbols before  in the input string are guessed. In the second stage, ParseIT generates the symbols that may follow  in the input string, till the end ($). Note that,  can itself be $, in which case no next symbol is needed. The second stage works identically to the generation of input string for incorrect shift entry.

Suppose the correct reduce entry in the cell L[][] is , then ParseIT guesses the stack to be , where represents the sequence of states corresponding to an unknown prefix of the desired input, and is the sequence of states corresponding to , the RHS of correct reduce rule in the cell of interest. The input character now seen by the parser is  while a prefix string saves the already seen string–the terminal string derivable from symbols in . After reduction by the rule , the stack configuration becomes , where is obtained from the goto sub-table entry L[][].

If is known, we can find a satisfying prefix (the stack configuration ) by traversing the viable prefix DFA from start state to , and generating the terminal-only string corresponding to the traversed edge labels (node labels and edge labels for ). However, since we do not know these states, we use non-empty entries in the parse table to guess the possible choices:

Thus, represents the set of possible states before , and represents the set of possible states after on the stack. Suppose is the input character seen by the parser. We refine the choices using the following rules:

  1. For , if L[][] is error (empty), then is removed from , and all such that are removed from .

  2. If there is a state which has shift entry in L[][], we choose it, and ignore all other states from . One of the corresponding states in (i.e., such that ) is chosen for the before state. We now have a shift entry, L[][] to work on, which can be solved as described earlier.

  3. If there is no shift entry, we are left with the reduce entries. We choose any such state . We now have another instance of reduce entry problem L[][], which can be solved recursively. If there is a unit-production cycle in the grammar, care must be taken to avoid choosing the cyclic productions. This can be achieved by marking the productions already used.

The working of ParseIT for reduce entry problem is described in the following example:

PStr Pref
d4 a d
PStr Pref
0C2 a d
PStr Pref
0C2 a d
PStr Pref
C a d
PStr X
0C2a3 da {a, d}
0C2a3d4 dad {a, d, $}
0C2a3C6 dad {a, d, $}
0C2C5 dad {$}
0S1 dad$
accept dad$
Figure 4: Configurations of ParseIT while generating string for incorrect reduce entry for LR grammar.

Attempt2 (Attempt3) means correct solutions using up to one (two) hint(s) from ParseIT.

Figure 5: Comparing group averages: offline vs. ParseIT.

Attempt2 (Attempt3) means correct solutions using up to one (two) hint(s) from ParseIT.

Figure 6: Comparing individual averages: offline vs. ParseIT.
Example 4.3

Consider the grammar and parse table in Fig. 2. Suppose user makes an incorrect entry in the cell L[][] which contains entry “r3” i.e reduce by . The stack (), partial string (PStr), and the prefix string(Pref) configuration maintained by ParseIT at this stage are shown in Fig. 4(a). Here, d is the RHS of the reduce rule, as well as the terminal-only string. Applying the reduce rule, gives the configuration in Fig 4(b).

From parse table, the possible choices for are , and the choices for are . We refine the choices using the steps defined above:

  1. Since L[5][a] is an error entry, state 5 is removed from and corresponding state 2 is removed from .

  2. Out of the remaining states in , L[2][a] has a shift entry and L[6][a] has a reduce entry. We chose 2 for , and corresponding state 0 for .

We get configuration in Fig 4(c). Since is 0, the start state itself, is empty string (Fig 4(d)).

The problem is now changed to shift entry problem L[2][a], having partial string da (prefix and partial string concatenated). The configurations during the solution for the shift problem are as in Fig 4(e). So, dad is the desired input to exercise cell L[4][a].

5 User Study

To verify the effectiveness of ParseIT, we implemented the tool in Java. The prototype implementation is available as a JAR file from anonymous Dropbox link [20]. A web interface was created for the user study.

The user study was conducted with with 16 students who have already done an introductory course on Compiler Design. We used 2 grammars and created 22 questions of 1 mark each related to various sub-topics in parsing. The question papers are code named P1 and P2. The students were randomly divided into 4 groups of 4 students each, G1–G4.

Each group solved one question paper using ParseIT, and the other using pen and paper (offline mode). To maintain equality between the two approaches, we provided a cheat sheet containing the required rules to each student for offline mode. Further, the sequence of ParseIT mode and offline mode was alternated. In particular, the groups solved the grammar in the following order:

G1: P2 using offline followed by P1 using ParseIT
G2: P1 using ParseIT followed by P2 using offline
G3: P2 using ParseIT followed by P1 using offline
G4: P1 using offline followed by P2 using ParseIT

The students were asked to fill a survey about the effectiveness of ParseIT after solving both the papers.

Fig. 5 shows the average of marks for groups while Fig. 6 shows average marks for individuals with and without ParseIT. Comparing the average marks across sessions, we found that average marks for G4 remain unchanged while for G1 it reduced by 0.5. For both G2 and G3, the average marks increased by 1. If we include the correct answer after a hint is taken during ParseIT mode, we found that most student could get nearly full marks across the groups (average over all students improved to 21.75 from 18.50 for ParseIT without hints and 19.18 for offline). The biggest improvement was of 7 marks, for 3 students.

Even though the data set is small, it shows that online platform itself does not make a big difference in the understanding of parser concepts, but the hints’ mechanism that results in improvements in marks. The hints allow students to correct their mistakes early. It is also easy to figure out the source of confusion for students, which can be of help to the instructor. The post study survey also corroborated our inference: 15 students accepted that the hints provided a better understanding of parsing, and helped reach the correct solution. One student had a negative feedback as he commented that “Hints are produced as questions, which increases confusion as the user has already answered it wrong.”. However, generating hints in other forms (say natural language sentence) is an area of future long-term research.

6 Conclusions and Future Work

In this paper, we described ParseIT for teaching parsing techniques. Our approach is question-answering based: problems are generated automatically and given to students to explain the working of a parser. Further, the hints provided by the tool are also in forms of targeted questions that help a student discover her mistake and revise the concept at the same time. ParseIT allows students to learn the techniques at their own pace, according to their convenience. The user study shows that the interactive nature of ParseIT helps users to learn from their own mistakes through experiments, and reduce the burden on teachers and teaching assistants.

Similar tools exist to teach few other phases of a compiler. In future, we plan to integrate these tools with ParseIT, and develop new tools to automate tutoring of all the phases of the compiler. We also plan to build animations around these concepts to improve student experience and understanding. An interesting question that will require user study over a longer period is whether the hints just helps the students select the correct answer during the exam, or do they have a lasting learning effect. Our plan is to deploy ParseIT in a large class teaching Compilers, to understand its impact on learning.


  1. The generated parsers do produce debugging information when used with appropriate options, but this is of little didactical value as one needs to know the parsing algorithms to understand it.
  2. MCQs have their advantages as well as disadvantages [17]. We chose MCQ as it is easier for the system to evaluate student choices as compared to the free form text answers.
  3. In the rest of the paper, unless specified otherwise, we use the term incorrect choice for both the types of mistakes, i.e., the missing valid choice and the selected invalid choice.
  4. Hints are sometimes generated even when the user solution is correct (with a small probability). Otherwise, whenever the hint is generated, the user will know that her original answer was wrong, and may change it without understanding the concept.
  5. The interaction with ParseIT (questions and hints generated) are formatted for readability.
  6. We chose the shortest distance reduce state from , to generate shorter input string.
  7. Note that all reduce actions in a row will be the same.


  1. N. Agrawal. A tool for teaching parsing techniques. Master’s thesis, IIT Kanpur, 2015. karkare/MTP/2014-15/nimisha2015parsing.pdf.
  2. A. V. Aho, M. S. Lam, R. Sethi, and J. D. Ullman. Compilers: Princiles, Techniques, and Tools. Pearson Education, Inc, 2006.
  3. R. Alur, L. D’Antoni, S. Gulwani, D. Kini, and M. Viswanathan. Automated grading of DFA constructions. In International Joint Conference on Artificial Intelligence, IJCAI, pages 1976–1982, 2013.
  4. GNU Bison.
  5. Coursera.
  6. Compilers.
  7. Introduction to Compilers.
  8. Computer Science Curricula 2013., December 2013.
  9. Compilers.
  10. Principles of Compiler Design. karkare/courses/2011/cs335.
  11. L. D’Antoni, D. Kini, R. Alur, S. Gulwani, M. Viswanathan, and B. Hartmann. How can automatic feedback help students construct automata? ACM Trans. Comput.-Hum. Interact., 22(2):9:1–9:24, 2015.
  12. A. Demaille. Making compiler construction projects relevant to core curriculums. In Innovation and Technology in Computer Science Education, ITiCSE, 2005.
  13. A. Demaille, R. Levillain, and B. Perrot. A set of tools to teach compiler construction. In Innovation and Technology in Computer Science Education, ITiCSE, 2008.
  14. edX.
  15. S. Gulwani. Example-based learning in computer- aided STEM education. Commun. ACM, 57(8):70–80, 2014.
  16. E. J. Lorenzo, J. Velez, and A. Peñas. A proposal for automatic evaluation in a compiler construction course. In Innovation and Technology in Computer Science Education, ITiCSE, pages 308–312, 2011.
  17. Computer Science Curricula 2013., Last Accessed October 2016.
  18. M. Mernik and V. Zumer. An educational tool for teaching compiler construction. IEEE Trans. Education, 46(1):61–68, 2003.
  19. NPTEL: National Programme on Technology Enhanced Learning.
  20. ParseIT Implementation.
  21. R. Singh, S. Gulwani, and A. Solar-Lezama. Automated feedback generation for introductory programming assignments. In Programming Language Design and Implementation, PLDI, pages 15–26, 2013.
  22. T. Sondag, K. L. Pokorny, and H. Rajan. Frances: A tool for understanding code generation. In ACM Technical Symposium on Computing Science Education, SIGCSE, 2010.
  23. J. Urquiza-Fuentes, F. Manso, J. A. Velázquez-Iturbide, and M. Rubio-Sánchez. Improving compilers education through symbol tables animations. In Innovation and Technology in Computer Science Education, ITiCSE, 2011.
  24. W. M. Waite. The compiler course in today’s curriculum: Three strategies. SIGCSE Bull., 38(1):87–91, Mar. 2006.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minumum 40 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description