SyntaxTutor
Educational app designed to help compiler students understand LL(1) and SLR(1) parsing algorithms.
 
Loading...
Searching...
No Matches
SLRWizard Class Reference

Interactive assistant that guides the student step-by-step through the SLR(1) parsing table. More...

#include <slrwizard.h>

Inheritance diagram for SLRWizard:
Collaboration diagram for SLRWizard:

Public Member Functions

 SLRWizard (SLR1Parser &parser, const QVector< QVector< QString > > &rawTable, const QStringList &colHeaders, const QVector< QPair< QString, QVector< QString > > > &sortedGrammar, QWidget *parent=nullptr)
 Constructs the SLR(1) wizard with all necessary parsing context.
 
QVector< QString > stdVectorToQVector (const std::vector< std::string > &vec)
 Converts a std::vector<std::string> to QVector<QString> for UI compatibility.
 

Detailed Description

Interactive assistant that guides the student step-by-step through the SLR(1) parsing table.

This wizard-based dialog presents the user with one cell of the SLR(1) parsing table at a time, asking them to deduce the correct ACTION or GOTO entry based on the LR(0) automaton and FOLLOW sets. It is designed as an educational aid to explain the reasoning behind each parsing decision.

Each page includes:

  • The current state and symbol (terminal or non-terminal).
  • A guided explanation based on the grammar and LR(0) state.
  • The expected entry (e.g., s3, r1, acc, or a state number).

Constructor & Destructor Documentation

◆ SLRWizard()

SLRWizard::SLRWizard ( SLR1Parser & parser,
const QVector< QVector< QString > > & rawTable,
const QStringList & colHeaders,
const QVector< QPair< QString, QVector< QString > > > & sortedGrammar,
QWidget * parent = nullptr )
inline

Constructs the SLR(1) wizard with all necessary parsing context.

Parameters
parserThe SLR(1) parser instance containing the LR(0) states and transitions.
rawTableThe target parsing table (student version or reference).
colHeadersHeader symbols (terminals and non-terminals).
sortedGrammarOrdered list of grammar rules for reduce explanations.
parentParent widget.
Here is the call graph for this function:

Member Function Documentation

◆ stdVectorToQVector()

QVector< QString > SLRWizard::stdVectorToQVector ( const std::vector< std::string > & vec)
inline

Converts a std::vector<std::string> to QVector<QString> for UI compatibility.

Parameters
vecThe input vector of strings.
Returns
A QVector of QStrings.
Here is the caller graph for this function:

The documentation for this class was generated from the following file: