0% found this document useful (0 votes)
76 views5 pages

Parsing Teaching Tools Report

The document discusses several tools that are used to teach parsing to students, including JFLAP, ParseIT, LR(0), and LL(1). JFLAP is a visualization tool that supports parsers like LL(1), SLR(1), and CYK. It allows users to enter a context-free grammar and see the parse trees generated. ParseIT is a question-based teaching tool that generates questions about parsing concepts and handles LL(1) and SLR(1) parsers. It can detect issues like left recursion. LR(0) and LL(1) are additional tools that visualize parsing processes for their respective parsers. The tools aim to make compiler design more interactive and easy to understand for students.

Uploaded by

Pranav Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views5 pages

Parsing Teaching Tools Report

The document discusses several tools that are used to teach parsing to students, including JFLAP, ParseIT, LR(0), and LL(1). JFLAP is a visualization tool that supports parsers like LL(1), SLR(1), and CYK. It allows users to enter a context-free grammar and see the parse trees generated. ParseIT is a question-based teaching tool that generates questions about parsing concepts and handles LL(1) and SLR(1) parsers. It can detect issues like left recursion. LR(0) and LL(1) are additional tools that visualize parsing processes for their respective parsers. The tools aim to make compiler design more interactive and easy to understand for students.

Uploaded by

Pranav Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Tools to Teach Parsing

ANONYMOUS AUTHOR(S)

1 TOOLS TO TEACH PARSING


The students in a compiler class use standard parser generator tools to generate parsers for their language, specified as a
given context-free grammar. The most commonly used parser generators are YACC [7], Bison [4], ANTLR [9], CUP [6],
PLY [3], and their variants. These tools are developed for professional compiler developers who know compiler design
theory. For the students developing a small compiler as a course project, using these tools could be a very cumbersome
task as students are still learning the theoretical knowledge of parsing. Therefore, many teaching tools are developed to
visualize the parsing processes. These teaching tools have user-friendly features, such as alerts, error highlighting, a
simple user interface, visualizations, and simple to understand feedback messages. These tools focus on pedagogical
aspects of parsing, to provide students with a detailed understanding of the parsing processes.

1.1 Tools’ Availability Summary

Table 1. Summary of the features of the teaching tools

Tools Available Link


JFLAP JFLAP website
ParseIT Download Link
ParseIT++ ParseIT++ link
LR(0) LR(0) Link
LL(1) LL(1) Link

We have explored four such teaching tools, viz. ParseIT, LL(1), LR(0), and JFLAP, and present their comparison in
this paper. JFLAP, LL(1), and LR(0) target practical aspects of parsing through visualizations, whereas ParseIT uses a
question-answer-based approach to help students understand theoretical concepts of parsing. The intention behind
each approach is to make the compiler design course interactive and easy to understand for the students. We now
describe each of these tools in detail.

1.2 JFLAP
JFLAP [11] project started at Rensselaer Polytechnic Institute as a collection of tools. Later it was moved to Duke
University. Users can download it from [10]. JFLAP is a visualization tool and it is not only suitable for teaching parsing
but, also provides the features that can be used in other CS courses. It supports different kinds of parsers, from which we
experimented with SLR(1), LL(1), CYK, and brute-force parsers. We have listed below the features of JFLAP according
to our experience while using the tool:
(1) Installation: JFLAP is a jar executable application, users do not have to install the application. But for executing
JFLAP, users must have Java JDK and JRE installed in the system.
Manuscript submitted to ACM 1
2 Anon.

Table 2. Summary of the features of the teaching tools

✓ signifies that parser provides the corresponding feature


× signifies that parser does not provides the corresponding feature.
− signifies that corresponding feature is not applicable for the parser
JFLAP JFLAP LR(0) LL(1) JFLAP JFLAP ParseIT ParseIT
Feature LL(1) SLR(1) Tool Tool Brute-Force CYK LL(1) SLR(1)
Parse Table ✓ ✓ − ✓ − − ✓ ✓
Parsing × ✓ ✓ ✓ ✓ × × ×
Visualization ✓ ✓ ✓ ✓ ✓ ✓ × ×
Auto-String Generation × × × × × × ✓ ✓

Table 3. Parsers supported by the teaching tools

✓: Parser supported ×: Parser not supported


# Tool LL(1) LR(0) SLR(1) Brute-force CYK
1. JFLAP ✓ × ✓ ✓ ✓
2. LR(0) × ✓ × × ×
3. LL(1) ✓ × × × ×
4. ParseIT ✓ × ✓ × ×

(2) How to use: For running JFLAP, users have to run the “java -jar JFLAP.jar” command in the console from the
same folder where JFLAP.jar is present. It will open a window with many options, like “Finite Automaton”, “Moore
Machine”, “Mealy Machine”, etc. For parsing select the “Grammar” option which will open a separate window,
where users can enter the grammar. After entering the grammar users can select the corresponding parser in the
“Input” option.
(3) Available options: After selecting a parser, if users select brute-force or CYK parser it only gives the option to
input a string and visualize the parsing process. If users select LL(1) or SLR(1) parser, it gives the option to manually
fill first set, follow set, parse table, etc, and an option to automatically fill this data. If input grammar is not parsable
by the parser then, users can still have the option of parsing the string for SLR(1) and brute-force parser but users
do not get this option for LL(1) and CYK parser.
(4) Supported Parsers: JFLAP supports a lot of parsers including LL(1), SLR(1), brute-force parser, multiple brute-force
parser, user control parser, CYK parser, and multiple CYK parser. We used this tool for LL(1), SLR(1), brute-force
parser, and CYK parser.
(5) Grammar Format: There is a specific format in which it takes the input grammar which is very similar to
Backus–Naur form, the format used in classrooms. There are few restrictions on the set of terminals and non-
terminals, it treats every small alphabet as a terminal and every capital alphabet as a non-terminal. Users cannot
define terminals and non-terminals of more than one alphabet and also each symbol on RHS of a production rule
should not be space-separated. ‘𝜖’ symbol is represented using the ‘𝜆’ symbol.
Manuscript submitted to ACM
Tools to Teach Parsing 3

(6) Error Reporting and Messages: If grammar is not parsable by a parser, JFLAP reports it in different ways for
different parsers. In the case of LL(1), it gives a popup reporting that grammar is not LL(1) and lets users proceed to
parse table construction. In the case of SLR(1), it does not report but highlights the conflicted cells and users can
choose the entry for these cells. While parsing it informs about the steps taken and also highlights the corresponding
cells of the parse table. In the CYK parser, if the grammar does not accept any string it simply reports it and does
not move to the parsing option. Brute-force parser never reports anything about the grammar and always provides
users with the option to parse the string.
(7) Visualizations: It shows the visualizations of the parse trees. It also shows viable prefixes automaton for SLR(1)
parsers. But as the number of states increases, the automaton is not easy to visualize due to clutter. Along with the
parse tree, it also shows derivation and the inverted tree.
(8) Auto-String Generation: It doesn’t auto-generate any string for showing parsing but users have to input a string
for which they can see the complete parsing steps, parse tree, and derivation tree.

1.3 ParseIT and ParseIT++


ParseIT [8] was developed at the Indian Institute of Technology, Kanpur, and is available at [1]. ParseIT supports
LL(1) and SLR(1) parsers and we experimented with both the parsers. It is not a visualization tool but is a console
question-answer-based teaching tool. It auto-generates questions for a given grammar for various sections of the
parsing process. Depending on the user’s inputs it provides auto-generated hint questions to help students with the
problems. For the parsing table sections it auto generates a string corresponding to an erroneous entry in the table and
shows parsing steps to the users. In LL(1) parser, ParseIT can detect left recursion and non-determinism. In the case of
the LL(1) parser, if the grammar is not LL(1) but can be converted to LL(1) by left factoring, it can do so on the user’s
demand. Based on our experience we have detailed the features of ParseIT as follows:
(1) Installation: ParseIT is a jar executable application, users do not have to install the application. For executing
ParseIT, users must have Java JDK and JRE installed in their system.
(2) How to use: For executing ParseIT, users have to create a .txt file that contains the input grammar. Then execute
ParseIT using the command “java -jar ParseIT.jar txt-file-name” on the console in the same folder where ParseIT.jar
is present. It is a console-based application so all the options are available on the console itself. From there users
have to select an option and an auto-generated question will appear. Users have to write their answers in the console
and based on user input it auto-generates the hint questions. For parse table options it generates an input string
and shows the parsing steps for that string.
(3) Available options: ParseIT gives the options for quizzes on the first set, follow set, SLR closure, SLR goto, parsing
table, and parsing moves. Based on user inputs it auto-generates the questions and rule-based hint questions
or input strings (in case of parsing table options). For the parsing table, it provides users with two options, one
where it generates an input string and the second where it generates rule-based hint questions. Users also have
the option of parsing a string but after giving a string, users have to complete the parsing steps and it is also a
question-answer-based section. For incompatible grammar, users can use all the options except the Parsing Moves.
In case grammar is non-deterministic it allows users to left factor the grammar and proceed.
(4) Supported Parsers: ParseIT supports LL(1) and SLR(1) parsers.
(5) Grammar Format: The grammar format accepted by ParseIT is the same as used in classrooms which is also used
in the Dragon book [2]. For using the ‘𝜖’ symbol in the productions users have to write complete “epsilon” text in
place of ‘𝜖’.
Manuscript submitted to ACM
4 Anon.

(6) Error Reporting and Messages: ParseIT generates hint questions based on user input and does not do any
reporting or provide any messages. It generates a string and shows its parsing steps as hints for parse table problems.
ParseIT can detect the non-determinism and left-recursion in the grammar. In case of incompatible grammar, ParseIT
simply prints the message in the console and exits for Parsing Moves options.
(7) Visualizations: ParseIT does not show any visualizations for any option but shows the step-by-step parsing of the
string.
(8) Auto-String Generation: It can auto-generate the input string and show the parsing steps. Users can also input a
string for which they have to complete the parsing steps.
ParseIT++ is a web based tool build on top of ParseIT. It is available at [5]. It tries to cover the drawbacks of ParseIT,
as unlike ParseIT it provides GUI and visualizations. It also uses same question-answer based approach and can help
users to understand the parsing better. ParseIT++ tries to gamify the understanding of parsing process so that it could
become more interesting and easy for users.

1.4 LL(1) and LR(0) Tools


LL(1) and LR(0) tools are web-based tools available on the internet at [12] and [13] respectively. Both the tools show
visualization for parse trees while parsing an input string. LR(0) does not generate any parse table and parses the
string using LR(0) automaton. An interesting feature of LR(0) is that it can parse sentential forms (a string of terminals
and non-terminals of the Grammar) too. Following are the feature details about LL(1) and LR(0) tools based on our
experience:
(1) Installation: LL(1) and LR(0) tools are web-based tools hosted at [12] and [13] respectively. Users only need to
have a browser to use these tools.
(2) How to use: Users have to input the grammar and then click the “Generate tables” button in case of the LL(1) tool
and it will generate the parse table. Users can input a string and control the parsing steps. In the case of the LR(0)
tool users have to click “Generate LR(0) Automaton” which will generate the LR(0) automaton and users can parse
the input strings. Symbols should be space-separated in the input string.
(3) Available Options: In LL(1) and LR(0) tools, users only have the option of parsing strings. Users have to input a
string and then can visualize and understand the parsing process step by step. It allows users to parse strings even
if the grammar is incompatible with the parser (not parsable by the parser).
(4) Supported Parsers: LL(1) and LR(0) tools support LL(1) and LR(0) parsers respectively.
(5) Grammar Format: LL(1) and LR(0) tools accept grammar in BNF with some reserved symbols. Each production
rule should be in separate lines and symbols should be space-separated. There are a few restrictions on symbols
that can be used in grammar. In LL(1), the symbol ‘S’ is reserved and cannot be used as a terminal or non-terminal.
It always appends the grammar with a production rule “S → start symbol of the original grammar”. In LR(0) symbol
‘S ′ ’ is reserved for augmented production. In both the tools epsilon symbol is represented through empty single
quotation marks ”.
(6) Error Reporting and Messages: In LL(1), users can see the parsing stack and production rule used while building
the parse tree. LR(0) tool shows parsing stack and the last action performed, alongside the parse tree.
(7) Visualizations: Both the tools show the visualizations of parse trees. LR(0) also shows the LR(0) automaton.
(8) Auto-String Generation: Both the tools cannot generate any string for showing parsing but users have to input a
string for which they can see the complete parsing steps and parse tree.
Manuscript submitted to ACM
Tools to Teach Parsing 5

Table 2 provides a summary of the features of the teaching tools we explored. Data presented for Parse Table
and Parsing features is collected in the cases of incompatible input grammar. Data presented for Visualization and
Auto-String Generation feature is collected for general cases. Table 3 lists the parsers supported by each tool.

REFERENCES
[1] Nimisha Agarwal. 2016. ParseIT. https://cse.iitk.ac.in/users/nimisha/parseit/index.html
[2] Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. 2006. Compilers: Principles, Techniques, and Tools (2nd Edition). Addison-Wesley
Longman Publishing Co., Inc., USA.
[3] David Beazley. 2022. PLY (Python Lex Yacc). (2022). https://www.dabeaz.com/ply/ last accessed Jan 2022.
[4] Bison. 2022. GNU Bison. https://www.gnu.org/software/bison/ last accessed Jan 2022.
[5] Tushar Gautam. 2022. ParseIT. http://parseit.te2ch.com
[6] Scott E Hudson, Frank Flannery, C Scott Anaian, Dan Wang, and Andrew Appel. 2006. CUP parser generator for Java, 1997. http://www2.cs.tum.
edu/projects/cup/. (2006).
[7] Stephen C. Johnson. 1979. Yacc: Yet Another Compiler-Compiler. Technical Report.
[8] Amey Karkare and Nimisha Agrawal. 2016. ParseIT: A Tool for Teaching Parsing Techniques. In Proceedings of the 47th ACM Technical Symposium
on Computing Science Education (SIGCSE ’16). 590. https://doi.org/10.1145/2839509.2850513
[9] T. J. Parr and R. W. Quong. 1995. ANTLR: A Predicated LL(k) Parser Generator. Softw. Pract. Exper. 25, 7 (jul 1995), 789–810. https://doi.org/10.1002/
spe.4380250705
[10] S. H. Rodger. 2022. JFLAP. https://www.jflap.org/ last accessed Jan 2022.
[11] Susan H. Rodger, Eric Wiebe, Kyung Min Lee, Chris Morgan, Kareem Omar, and Jonathan Su. 2009. Increasing Engagement in Automata Theory
with JFLAP. In Proceedings of the 40th ACM Technical Symposium on Computer Science Education (Chattanooga, TN, USA) (SIGCSE ’09). Association
for Computing Machinery, New York, NY, USA, 403–407. https://doi.org/10.1145/1508865.1509011
[12] Zak Kincaid and Shaowei Zhu. 2022. LL(1) Tool. https://www.cs.princeton.edu/courses/archive/spring20/cos320/LL1/ last accessed Jan 2022.
[13] Zak Kincaid and Shaowei Zhu. 2022. LR(0) Tool. https://www.cs.princeton.edu/courses/archive/spring20/cos320/LR0/ last accessed Jan 2022.

Manuscript submitted to ACM

You might also like