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

Main window for the SLR(1) interactive tutoring mode in SyntaxTutor. More...

#include <slrtutorwindow.h>

Inheritance diagram for SLRTutorWindow:
Collaboration diagram for SLRTutorWindow:

Signals

void sessionFinished (int cntRight, int cntWrong)
 

Public Member Functions

 SLRTutorWindow (const Grammar &g, TutorialManager *tm=nullptr, QWidget *parent=nullptr)
 Constructs the SLR(1) tutor window with a given grammar.
 
 ~SLRTutorWindow ()
 
QString generateQuestion ()
 Generates a new question for the current tutor state.
 
void updateState (bool isCorrect)
 Updates tutor state based on whether the last answer was correct.
 
QString FormatGrammar (const Grammar &grammar)
 
void fillSortedGrammar ()
 < Utility for displaying grammar
 
void addMessage (const QString &text, bool isUser)
 < Prepares grammar in display-friendly format
 
void exportConversationToPdf (const QString &filePath)
 < Add message to chat
 
void showTable ()
 < Export full interaction
 
void launchSLRWizard ()
 < Render SLR(1) table
 
void updateProgressPanel ()
 
void addUserState (unsigned id)
 < Refresh visual progress
 
void addUserTransition (unsigned fromId, const std::string &symbol, unsigned toId)
 < Register a user-created state
 
void animateLabelPop (QLabel *label)
 
void animateLabelColor (QLabel *label, const QColor &flashColor)
 
void wrongAnimation ()
 
void wrongUserResponseAnimation ()
 
void markLastUserIncorrect ()
 
bool verifyResponse (const QString &userResponse)
 
bool verifyResponseForA (const QString &userResponse)
 
bool verifyResponseForA1 (const QString &userResponse)
 
bool verifyResponseForA2 (const QString &userResponse)
 
bool verifyResponseForA3 (const QString &userResponse)
 
bool verifyResponseForA4 (const QString &userResponse)
 
bool verifyResponseForB (const QString &userResponse)
 
bool verifyResponseForC (const QString &userResponse)
 
bool verifyResponseForCA (const QString &userResponse)
 
bool verifyResponseForCB (const QString &userResponse)
 
bool verifyResponseForD (const QString &userResponse)
 
bool verifyResponseForD1 (const QString &userResponse)
 
bool verifyResponseForD2 (const QString &userResponse)
 
bool verifyResponseForE (const QString &userResponse)
 
bool verifyResponseForE1 (const QString &userResponse)
 
bool verifyResponseForE2 (const QString &userResponse)
 
bool verifyResponseForF (const QString &userResponse)
 
bool verifyResponseForFA (const QString &userResponse)
 
bool verifyResponseForG (const QString &userResponse)
 
bool verifyResponseForH ()
 
QString solution (const std::string &state)
 
std::unordered_set< Lr0ItemsolutionForA ()
 
QString solutionForA1 ()
 
QString solutionForA2 ()
 
std::vector< std::pair< std::string, std::vector< std::string > > > solutionForA3 ()
 
std::unordered_set< Lr0ItemsolutionForA4 ()
 
unsigned solutionForB ()
 
unsigned solutionForC ()
 
QStringList solutionForCA ()
 
std::unordered_set< Lr0ItemsolutionForCB ()
 
QString solutionForD ()
 
QString solutionForD1 ()
 
QString solutionForD2 ()
 
std::ptrdiff_t solutionForE ()
 
QSet< unsigned > solutionForE1 ()
 
QMap< unsigned, unsigned > solutionForE2 ()
 
QSet< unsigned > solutionForF ()
 
QSet< QString > solutionForFA ()
 
QSet< QString > solutionForG ()
 
QString feedback ()
 
QString feedbackForA ()
 
QString feedbackForA1 ()
 
QString feedbackForA2 ()
 
QString feedbackForA3 ()
 
QString feedbackForA4 ()
 
QString feedbackForAPrime ()
 
QString feedbackForB ()
 
QString feedbackForB1 ()
 
QString feedbackForB2 ()
 
QString feedbackForBPrime ()
 
QString feedbackForC ()
 
QString feedbackForCA ()
 
QString feedbackForCB ()
 
QString feedbackForD ()
 
QString feedbackForD1 ()
 
QString feedbackForD2 ()
 
QString feedbackForDPrime ()
 
QString feedbackForE ()
 
QString feedbackForE1 ()
 
QString feedbackForE2 ()
 
QString feedbackForF ()
 
QString feedbackForFA ()
 
QString feedbackForG ()
 
QString TeachDeltaFunction (const std::unordered_set< Lr0Item > &items, const QString &symbol)
 
void TeachClosureStep (std::unordered_set< Lr0Item > &items, unsigned int size, std::unordered_set< std::string > &visited, int depth, QString &output)
 
QString TeachClosure (const std::unordered_set< Lr0Item > &initialItems)
 

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 

Detailed Description

Main window for the SLR(1) interactive tutoring mode in SyntaxTutor.

This class implements an interactive, step-by-step tutorial to teach students how to construct SLR(1) parsing tables, including closure, GOTO, automaton construction, FOLLOW sets, and the final table.

It supports animated feedback, pedagogical guidance, error correction, and export of the tutoring session.

The tutor follows a finite-state flow (StateSlr) to structure learning, with corrective explanations and automatic evaluation at each step.

Constructor & Destructor Documentation

◆ SLRTutorWindow()

SLRTutorWindow::SLRTutorWindow ( const Grammar & g,
TutorialManager * tm = nullptr,
QWidget * parent = nullptr )
explicit

Constructs the SLR(1) tutor window with a given grammar.

Parameters
gThe grammar used for the session.
tmOptional pointer to the tutorial manager (for guided tour).
parentParent widget.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~SLRTutorWindow()

SLRTutorWindow::~SLRTutorWindow ( )

Member Function Documentation

◆ addMessage()

void SLRTutorWindow::addMessage ( const QString & text,
bool isUser )

< Prepares grammar in display-friendly format

◆ addUserState()

void SLRTutorWindow::addUserState ( unsigned id)

< Refresh visual progress

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addUserTransition()

void SLRTutorWindow::addUserTransition ( unsigned fromId,
const std::string & symbol,
unsigned toId )

< Register a user-created state

Here is the caller graph for this function:

◆ animateLabelColor()

void SLRTutorWindow::animateLabelColor ( QLabel * label,
const QColor & flashColor )

◆ animateLabelPop()

void SLRTutorWindow::animateLabelPop ( QLabel * label)

◆ closeEvent()

void SLRTutorWindow::closeEvent ( QCloseEvent * event)
inlineoverrideprotected
Here is the call graph for this function:

◆ exportConversationToPdf()

void SLRTutorWindow::exportConversationToPdf ( const QString & filePath)

< Add message to chat

Here is the call graph for this function:

◆ feedback()

QString SLRTutorWindow::feedback ( )
Here is the call graph for this function:

◆ feedbackForA()

QString SLRTutorWindow::feedbackForA ( )
Here is the caller graph for this function:

◆ feedbackForA1()

QString SLRTutorWindow::feedbackForA1 ( )
Here is the caller graph for this function:

◆ feedbackForA2()

QString SLRTutorWindow::feedbackForA2 ( )
Here is the caller graph for this function:

◆ feedbackForA3()

QString SLRTutorWindow::feedbackForA3 ( )
Here is the caller graph for this function:

◆ feedbackForA4()

QString SLRTutorWindow::feedbackForA4 ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForAPrime()

QString SLRTutorWindow::feedbackForAPrime ( )
Here is the caller graph for this function:

◆ feedbackForB()

QString SLRTutorWindow::feedbackForB ( )
Here is the caller graph for this function:

◆ feedbackForB1()

QString SLRTutorWindow::feedbackForB1 ( )

◆ feedbackForB2()

QString SLRTutorWindow::feedbackForB2 ( )

◆ feedbackForBPrime()

QString SLRTutorWindow::feedbackForBPrime ( )

◆ feedbackForC()

QString SLRTutorWindow::feedbackForC ( )
Here is the caller graph for this function:

◆ feedbackForCA()

QString SLRTutorWindow::feedbackForCA ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForCB()

QString SLRTutorWindow::feedbackForCB ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForD()

QString SLRTutorWindow::feedbackForD ( )
Here is the caller graph for this function:

◆ feedbackForD1()

QString SLRTutorWindow::feedbackForD1 ( )
Here is the caller graph for this function:

◆ feedbackForD2()

QString SLRTutorWindow::feedbackForD2 ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForDPrime()

QString SLRTutorWindow::feedbackForDPrime ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForE()

QString SLRTutorWindow::feedbackForE ( )
Here is the caller graph for this function:

◆ feedbackForE1()

QString SLRTutorWindow::feedbackForE1 ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForE2()

QString SLRTutorWindow::feedbackForE2 ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForF()

QString SLRTutorWindow::feedbackForF ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForFA()

QString SLRTutorWindow::feedbackForFA ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ feedbackForG()

QString SLRTutorWindow::feedbackForG ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillSortedGrammar()

void SLRTutorWindow::fillSortedGrammar ( )

< Utility for displaying grammar

◆ FormatGrammar()

QString SLRTutorWindow::FormatGrammar ( const Grammar & grammar)

◆ generateQuestion()

QString SLRTutorWindow::generateQuestion ( )

Generates a new question for the current tutor state.

Returns
The formatted question string.
Here is the call graph for this function:

◆ launchSLRWizard()

void SLRTutorWindow::launchSLRWizard ( )

< Render SLR(1) table

◆ markLastUserIncorrect()

void SLRTutorWindow::markLastUserIncorrect ( )

◆ sessionFinished

void SLRTutorWindow::sessionFinished ( int cntRight,
int cntWrong )
signal
Here is the caller graph for this function:

◆ showTable()

void SLRTutorWindow::showTable ( )

< Export full interaction

Here is the caller graph for this function:

◆ solution()

QString SLRTutorWindow::solution ( const std::string & state)

◆ solutionForA()

std::unordered_set< Lr0Item > SLRTutorWindow::solutionForA ( )
Here is the caller graph for this function:

◆ solutionForA1()

QString SLRTutorWindow::solutionForA1 ( )
Here is the caller graph for this function:

◆ solutionForA2()

QString SLRTutorWindow::solutionForA2 ( )
Here is the caller graph for this function:

◆ solutionForA3()

std::vector< std::pair< std::string, std::vector< std::string > > > SLRTutorWindow::solutionForA3 ( )
Here is the caller graph for this function:

◆ solutionForA4()

std::unordered_set< Lr0Item > SLRTutorWindow::solutionForA4 ( )
Here is the caller graph for this function:

◆ solutionForB()

unsigned SLRTutorWindow::solutionForB ( )
Here is the caller graph for this function:

◆ solutionForC()

unsigned SLRTutorWindow::solutionForC ( )
Here is the caller graph for this function:

◆ solutionForCA()

QStringList SLRTutorWindow::solutionForCA ( )
Here is the caller graph for this function:

◆ solutionForCB()

std::unordered_set< Lr0Item > SLRTutorWindow::solutionForCB ( )
Here is the caller graph for this function:

◆ solutionForD()

QString SLRTutorWindow::solutionForD ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solutionForD1()

QString SLRTutorWindow::solutionForD1 ( )
Here is the caller graph for this function:

◆ solutionForD2()

QString SLRTutorWindow::solutionForD2 ( )
Here is the caller graph for this function:

◆ solutionForE()

std::ptrdiff_t SLRTutorWindow::solutionForE ( )
Here is the caller graph for this function:

◆ solutionForE1()

QSet< unsigned > SLRTutorWindow::solutionForE1 ( )
Here is the caller graph for this function:

◆ solutionForE2()

QMap< unsigned, unsigned > SLRTutorWindow::solutionForE2 ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solutionForF()

QSet< unsigned > SLRTutorWindow::solutionForF ( )
Here is the caller graph for this function:

◆ solutionForFA()

QSet< QString > SLRTutorWindow::solutionForFA ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solutionForG()

QSet< QString > SLRTutorWindow::solutionForG ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TeachClosure()

QString SLRTutorWindow::TeachClosure ( const std::unordered_set< Lr0Item > & initialItems)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TeachClosureStep()

void SLRTutorWindow::TeachClosureStep ( std::unordered_set< Lr0Item > & items,
unsigned int size,
std::unordered_set< std::string > & visited,
int depth,
QString & output )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TeachDeltaFunction()

QString SLRTutorWindow::TeachDeltaFunction ( const std::unordered_set< Lr0Item > & items,
const QString & symbol )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateProgressPanel()

void SLRTutorWindow::updateProgressPanel ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateState()

void SLRTutorWindow::updateState ( bool isCorrect)

Updates tutor state based on whether the last answer was correct.

Parameters
isCorrectWhether the user's answer was correct.
Here is the call graph for this function:

◆ verifyResponse()

bool SLRTutorWindow::verifyResponse ( const QString & userResponse)
Here is the call graph for this function:

◆ verifyResponseForA()

bool SLRTutorWindow::verifyResponseForA ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForA1()

bool SLRTutorWindow::verifyResponseForA1 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForA2()

bool SLRTutorWindow::verifyResponseForA2 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForA3()

bool SLRTutorWindow::verifyResponseForA3 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForA4()

bool SLRTutorWindow::verifyResponseForA4 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForB()

bool SLRTutorWindow::verifyResponseForB ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForC()

bool SLRTutorWindow::verifyResponseForC ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForCA()

bool SLRTutorWindow::verifyResponseForCA ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForCB()

bool SLRTutorWindow::verifyResponseForCB ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForD()

bool SLRTutorWindow::verifyResponseForD ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForD1()

bool SLRTutorWindow::verifyResponseForD1 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForD2()

bool SLRTutorWindow::verifyResponseForD2 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForE()

bool SLRTutorWindow::verifyResponseForE ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForE1()

bool SLRTutorWindow::verifyResponseForE1 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForE2()

bool SLRTutorWindow::verifyResponseForE2 ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForF()

bool SLRTutorWindow::verifyResponseForF ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForFA()

bool SLRTutorWindow::verifyResponseForFA ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForG()

bool SLRTutorWindow::verifyResponseForG ( const QString & userResponse)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ verifyResponseForH()

bool SLRTutorWindow::verifyResponseForH ( )
Here is the caller graph for this function:

◆ wrongAnimation()

void SLRTutorWindow::wrongAnimation ( )

◆ wrongUserResponseAnimation()

void SLRTutorWindow::wrongUserResponseAnimation ( )

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