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