Skip to content

Commit fd46416

Browse files
committed
Minor corrections and README update.
1 parent 3bf3c34 commit fd46416

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
1-
# Ascending Syntaxt Parser LR(1)
1+
# Ascending Syntax Parser LR(1)
2+
3+
This project is a **specific LR(1) (LALR optimized) Ascending Syntax Parser** for the grammar provided in the subject (see `docs/sujet_tp.pdf`).
24

35
> circular imports, templating, template specialisation, state DP, singleton DP, GDB debugging
46
7+
![make run output example](./img/make_run_example.png)
8+
9+
This program has been tested and built for Linux (tested on Ubuntu 20.04).
10+
511
### Useful links
612

713
[solve circular imports](https://pvigier.github.io/2018/02/09/dependency-graph.html)
814

915
[Use GDB debugger](https://www.bitdegree.org/learn/gdb-debugger)
1016

17+
## Compile and run
18+
19+
To run the main program:
20+
21+
1. `make dirs` inside the root folder of the project.
22+
2. `make` or `make build`
23+
3. Run the program directly using `./bin/main <expression>` or use `make run`.
24+
25+
To run the tests:
26+
27+
1. `make build_test` or `make all`
28+
2. Run the program using `./bin/test` or `make run_test`.
1129

1230
## Notes
1331

File renamed without changes.

img/make_run_example.png

205 KB
Loading

inc/main/Automaton.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ class Automaton
4545
void clearVectors();
4646
ParsingResult isActionAccepted();
4747
void printCurrentSituation();
48+
void printInputExpression(std::string const & inputExpression);
4849
};

src/main/Automaton.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ void Automaton::init(string const & inputExpression)
5555

5656
void Automaton::lexicalAnalysis(std::string const & inputExpression)
5757
{
58+
printInputExpression(inputExpression);
59+
5860
// create list of symbols with lexer
5961
Lexer l(inputExpression);
6062
Symbol * s;
@@ -81,6 +83,20 @@ void Automaton::lexicalAnalysis(std::string const & inputExpression)
8183
printVector("states", states);
8284
}
8385

86+
void Automaton::printInputExpression(std::string const & inputExpression)
87+
{
88+
std::string logLine = "";
89+
#ifdef COLORS
90+
logLine += LIGHT_ORANGE;
91+
#endif
92+
logLine += "===> Input expression: ";
93+
logLine += inputExpression;
94+
#ifdef COLORS
95+
logLine += NO_COLOR;
96+
#endif
97+
std::cout << logLine << std::endl;
98+
}
99+
84100
ParsingResult Automaton::Parsing(std::string const & inputExpression)
85101
{
86102
init(inputExpression);

0 commit comments

Comments
 (0)