Skip to content

Commit fc12357

Browse files
authored
Merge pull request #53 from jose-rZM/release-1.0.2
Release 1.0.2
2 parents 4b63cdc + 0a0eb30 commit fc12357

File tree

688 files changed

+16234
-18623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

688 files changed

+16234
-18623
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
- name: Upload artifact
118118
uses: actions/upload-artifact@v4
119119
with:
120-
name: macos-intel
120+
name: SyntaxTutor-macos-intel
121121
path: SyntaxTutor-intel.zip
122122
build-macos:
123123
runs-on: macos-latest
@@ -221,7 +221,7 @@ jobs:
221221
- name: Upload artifacts
222222
uses: actions/upload-artifact@v4
223223
with:
224-
name: macos-artifacts
224+
name: SyntaxTutor-macos-arm64
225225
path: |
226226
SyntaxTutor.app
227227
@@ -266,7 +266,7 @@ jobs:
266266
- name: Upload Windows ZIP
267267
uses: actions/upload-artifact@v4
268268
with:
269-
name: windows-deploy
269+
name: SyntaxTutor-windows-x64
270270
path: deploy
271271

272272
build-linux:
@@ -321,5 +321,5 @@ jobs:
321321
- name: Upload Linux AppImage
322322
uses: actions/upload-artifact@v4
323323
with:
324-
name: linux-appimage
324+
name: SyntaxTutor-linux-x86_64
325325
path: '*.AppImage'

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.0.2] - 2025-07-16
6+
### Fixed
7+
- Fixed issue when exporting PDF in SLR mode.
8+
- Fixed some feedback in SLR mode
9+
510
## [1.0.1] - 2025-06-17
611
### Added
712
- Added `Doxyfile` for automatic documentation generation with Doxygen.

Doxyfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,7 @@ FORMULA_MACROFILE =
18931893
# The default value is: NO.
18941894
# This tag requires that the tag GENERATE_HTML is set to YES.
18951895

1896-
USE_MATHJAX = NO
1896+
USE_MATHJAX = YES
18971897

18981898
# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
18991899
# Note that the different versions of MathJax have different requirements with
@@ -1934,8 +1934,7 @@ MATHJAX_FORMAT = HTML-CSS
19341934
# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
19351935
# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
19361936
# This tag requires that the tag USE_MATHJAX is set to YES.
1937-
1938-
MATHJAX_RELPATH =
1937+
MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2
19391938

19401939
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
19411940
# extension names that should be enabled during MathJax rendering. For example

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ Precompiled builds of SyntaxTutor are available in the Releases tab:
8585
To build SyntaxTutor from source, you just need:
8686
- Qt6 (including `qmake6`)
8787
- A C++20-compliant compiler
88-
```
88+
```bash
8989
qmake6
9090
make
91-
````
91+
```
9292
---
9393

9494
### 📚 Documentation

UniqueQueue.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
* @class UniqueQueue
88
* @brief A queue that ensures each element is inserted only once.
99
*
10-
* This data structure behaves like a standard FIFO queue but prevents duplicate insertions.
10+
* This data structure behaves like a standard FIFO queue but prevents duplicate
11+
* insertions.
1112
*
12-
* Internally, it uses a `std::queue` for ordering and a `std::unordered_set` to track seen elements.
13+
* Internally, it uses a `std::queue` for ordering and a `std::unordered_set` to
14+
* track seen elements.
1315
*
14-
* @tparam T The type of elements stored in the queue. Must be hashable and comparable.
16+
* @tparam T The type of elements stored in the queue. Must be hashable and
17+
* comparable.
1518
*/
16-
template<typename T>
17-
class UniqueQueue {
18-
public:
19+
template <typename T> class UniqueQueue {
20+
public:
1921
/**
2022
* @brief Pushes an element to the queue if it hasn't been inserted before.
2123
* @param value The element to insert.
@@ -39,28 +41,25 @@ class UniqueQueue {
3941
* @brief Accesses the front element of the queue.
4042
* @return A reference to the front element.
4143
*/
42-
const T& front() const {
43-
return queue_.front();
44-
}
44+
const T& front() const { return queue_.front(); }
4545

4646
/**
4747
* @brief Checks whether the queue is empty.
4848
* @return true if the queue is empty; false otherwise.
4949
*/
50-
bool empty() const {
51-
return queue_.empty();
52-
}
50+
bool empty() const { return queue_.empty(); }
5351

5452
/**
5553
* @brief Clears the queue and the set of seen elements.
5654
*/
5755
void clear() {
58-
while(!queue_.empty()) queue_.pop();
56+
while (!queue_.empty())
57+
queue_.pop();
5958
seen_.clear();
6059
}
6160

62-
private:
63-
std::queue<T> queue_; ///< Underlying FIFO queue.
64-
std::unordered_set<T> seen_; ///< Set of already inserted elements.
61+
private:
62+
std::queue<T> queue_; ///< Underlying FIFO queue.
63+
std::unordered_set<T> seen_; ///< Set of already inserted elements.
6564
};
6665
#endif // UNIQUEQUEUE_H

backend/grammar_factory.hpp

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ struct GrammarFactory {
144144
*/
145145
FactoryItem CreateLv2Item();
146146

147-
// -------- SANITY CHECKS --------
148-
149147
/**
150148
* @brief Checks if a grammar contains unreachable symbols (non-terminals
151149
* that cannot be derived from the start symbol).
@@ -158,9 +156,13 @@ struct GrammarFactory {
158156
* @brief Checks if a grammar is infinite, meaning there are non-terminal
159157
* symbols that can never derive a terminal string. This happens when a
160158
* production leads to an infinite recursion or an endless derivation
161-
* without reaching terminal symbols. For example, a production like: S -> A
159+
* without reaching terminal symbols.
160+
* For example, a production like:
161+
* \code
162+
* S -> A
162163
* A -> a A | B
163164
* B -> c B
165+
* \endcode
164166
* could lead to an infinite derivation of non-terminals.
165167
* @param grammar The grammar to check.
166168
* @return true if the grammar has infinite derivations, false otherwise.
@@ -196,28 +198,50 @@ struct GrammarFactory {
196198
*/
197199
std::unordered_set<std::string> NullableSymbols(const Grammar& grammar) const;
198200

199-
// -------- TRANSFORMATIONS --------
200201
/**
201-
* @brief Removes direct left recursion in a grammar. A grammar has direct
202-
* left recursion when one of its productions is A -> A a, where A is a non
203-
* terminal symbol and "a" the rest of the production. The procedure removes
204-
* direct left recursion by adding a new non terminal. So, if the
205-
* productions with left recursion are A -> A a | b, the result would be A
206-
* -> b A'; A'-> a A' | EPSILON
207-
* @param grammar The grammar to remove left recursion
202+
* @brief Removes direct left recursion in a grammar.
203+
* A grammar has direct left recursion when one of its productions is
204+
* \code
205+
* A -> A a
206+
* \endcode
207+
* where A is a non-terminal symbol and "a" the rest of the production.
208+
* The procedure removes direct left recursion by adding a new
209+
* non-terminal. So, if the productions with left recursion are:
210+
* \code
211+
* A -> A a | b
212+
* \endcode
213+
* the result would be:
214+
* \code
215+
* A -> b A'
216+
* A' -> a A' | epsilon
217+
* \endcode
218+
* @param grammar The grammar to remove left recursion.
208219
*/
220+
209221
void RemoveLeftRecursion(Grammar& grammar);
210222

211223
/**
212-
* @brief Perfoms left factorization. A grammar could be left factorized if
213-
* it have productions with the same prefix for one non terminal. For
214-
* example, A -> a x | a y; could be left factorized because it has "a" as
215-
* the common prefix. The left factorization is done by adding a new non
216-
* terminal symbol that contains the uncommon part, and by unifying the
217-
* common prefix in a one producion. So, A -> a x | a y would be A -> a A';
218-
* A' -> x | y.
224+
* @brief Performs left factorization.
225+
* A grammar can be left factorized if it has productions with the
226+
* same prefix for one non-terminal. For example:
227+
* \code
228+
* A -> a x | a y
229+
* \endcode
230+
* could be left factorized because it has "a" as the common prefix.
231+
* The left factorization is done by adding a new non-terminal symbol
232+
* that contains the uncommon part, and by unifying the common prefix in one
233+
* production. So:
234+
* \code
235+
* A -> a x | a y
236+
* \endcode
237+
* would become:
238+
* \code
239+
* A -> a A'
240+
* A' -> x | y
241+
* \endcode
219242
* @param grammar The grammar to be left factorized.
220243
*/
244+
221245
void LeftFactorize(Grammar& grammar);
222246

223247
/**

backend/ll1_parser.hpp

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ class LL1Parser {
4646
* production, indicating no conflicts. If conflicts are found, the function
4747
* will return `false`, signaling that the grammar is not LL(1).
4848
*
49-
* - For each production rule `A -> α`, the function calculates the director
50-
* symbols using the `director_symbols` function.
49+
* - For each production rule \f(A \rightarrow \alpha\f), the function
50+
* calculates the prediction symbols using the `PredictionSymbols` function.
5151
* - It then fills the parsing table at the cell corresponding to the
52-
* non-terminal `A` and each director symbol in the set.
52+
* non-terminal `A` and each prediction symbol in the set.
5353
* - If a cell already contains a production, this indicates a conflict,
5454
* meaning the grammar is not LL(1).
5555
*
@@ -103,27 +103,25 @@ class LL1Parser {
103103
/**
104104
* @brief Computes the FOLLOW sets for all non-terminal symbols in the
105105
* grammar.
106-
*
107-
* The FOLLOW set of a non-terminal symbol A contains all terminal symbols
108-
* that can appear immediately after A in any sentential form derived from
109-
* the grammar's start symbol. Additionally, if A can be the last symbol in
110-
* a derivation, the end-of-input marker (`$`) is included in its FOLLOW
111-
* set.
112-
*
106+
* The FOLLOW set of a non-terminal symbol A contains all terminal
107+
* symbols that can appear immediately after A in any sentential form
108+
* derived from the grammar's start symbol. Additionally, if A can be the
109+
* last symbol in a derivation, the end-of-input marker (`\$`) is included
110+
* in its FOLLOW set.
113111
* This function computes the FOLLOW sets using the following rules:
114-
* 1. Initialize FOLLOW(S) = { $ }, where S is the start symbol.
115-
* 2. For each production rule of the form A → αBβ:
116-
* - Add FIRST(β) (excluding ε) to FOLLOW(B).
117-
* - If ε ∈ FIRST(β), add FOLLOW(A) to FOLLOW(B).
112+
* 1. Initialize FOLLOW(S) = { \f( \$ \f) }, where S is the start symbol.
113+
* 2. For each production rule of the form \f( A \rightarrow \alpha B \beta
114+
* \f):
115+
* - Add \f( FIRST(\beta) \setminus \{\epsilon\} \f) to \f( FOLLOW(B)
116+
* \f).
117+
* - If \f( \epsilon \in FIRST(\beta) \f), add \f( FOLLOW(A) \f) to
118+
* \f( FOLLOW(B) \f).
118119
* 3. Repeat step 2 until no changes occur in any FOLLOW set.
119-
*
120-
* The computed FOLLOW sets are cached in the `follow_sets_` member variable
121-
* for later use by the parser.
122-
*
123-
* @note This function assumes that the FIRST sets for all symbols have
124-
* already been computed and are available in the `first_sets_` member
120+
* The computed FOLLOW sets are cached in the `follow_sets_` member
121+
* variable for later use by the parser.
122+
* @note This function assumes that the FIRST sets for all symbols
123+
* have already been computed and are available in the `first_sets_` member
125124
* variable.
126-
*
127125
* @see First
128126
* @see follow_sets_
129127
*/
@@ -148,20 +146,19 @@ class LL1Parser {
148146
/**
149147
* @brief Computes the prediction symbols for a given
150148
* production rule.
151-
*
152-
* The prediction symbols for a rule,
153-
* determine the set of input symbols that can trigger this rule in the
154-
* parsing table. This function calculates the prediction symbols based on
155-
* the FIRST set of the consequent and, if epsilon (the empty symbol) is in
156-
* the FIRST set, also includes the FOLLOW set of the antecedent.
157-
*
158-
* - If the FIRST set of the consequent does not contain epsilon, the
159-
* prediction symbols are simply the FIRST symbols of the consequent.
149+
* * The prediction symbols for a rule determine the set of input
150+
* symbols that can trigger this rule in the parsing table. This function
151+
* calculates the prediction symbols based on the FIRST set of the
152+
* consequent and, if epsilon (the empty symbol) is in the FIRST set, also
153+
* includes the FOLLOW set of the antecedent.
154+
* * - If the FIRST set of the consequent does not contain epsilon, the
155+
* prediction symbols are simply the FIRST symbols of the consequent.
160156
* - If the FIRST set of the consequent contains epsilon, the prediction
161-
* symbols are computed as (FIRST(consequent) - {epsilon}) ∪
162-
* FOLLOW(antecedent).
163-
*
164-
* @param antecedent The left-hand side non-terminal symbol of the rule.
157+
* symbols are computed as
158+
* \f( FIRST(\text{consequent}) \setminus \{\epsilon\} \cup
159+
* FOLLOW(\text{antecedent}) \f).
160+
* * @param antecedent The left-hand side non-terminal symbol of the
161+
* rule.
165162
* @param consequent A vector of symbols on the right-hand side of the rule
166163
* (production body).
167164
* @return An unordered set of strings containing the prediction symbols for

backend/lr0_item.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
* @struct Lr0Item
88
* @brief Represents an LR(0) item used in LR automata construction.
99
*
10-
* An LR(0) item has a production of the form A → α·β, where the dot indicates the current parsing position.
11-
* This structure tracks the antecedent (left-hand side), consequent (right-hand side), the dot position,
12-
* and special symbols like EPSILON and end-of-line ($).
10+
* An LR(0) item has a production of the form \f( A \rightarrow \alpha \bullet
11+
* \beta \f), where the dot indicates the current parsing position.
12+
*
13+
* This structure tracks the antecedent (left-hand side), consequent (right-hand
14+
* side), the dot position, and special symbols like EPSILON and end-of-line
15+
* ($).
1316
*/
17+
1418
struct Lr0Item {
1519
/**
1620
* @brief The non-terminal on the left-hand side of the production.
@@ -23,7 +27,7 @@ struct Lr0Item {
2327
std::vector<std::string> consequent_;
2428

2529
/**
26-
* @brief The symbol representing the empty string (ε).
30+
* @brief The symbol representing the empty string (\f(\epsilon\f)).
2731
*/
2832
std::string epsilon_;
2933

0 commit comments

Comments
 (0)