Commit 5d05f38c authored by Pierre Brandone's avatar Pierre Brandone
Browse files

TC-1 bugs: add explainations about flex patterns not reached

* source/compiler_stages/stage_presentation.rst,
* source/compiler_stages/tc_1/recurring_bugs.rst,
* source/compiler_stages/tc_1/tc_1.rst: Here.
parent fb16a1dc
......@@ -44,6 +44,11 @@ T *n* FAQ, Questions not to ask
questions. And since they are already answered, you should not ask
T *n* Recurring bugs, The same bugs through the ages
During debugs, there is always some few bugs that repeats everytime. To save
everybody's time, go and check this section when you encounter a bug before
asking for a debug.
T *n* Improvements, Other Designs
The |Project| Compiler is an instructional project the audience of which
is *learning* C++. Therefore, although by the end of the
.. _TC-1 Recurring bugs:
TC-1 Recurring bugs
Lexer patterns not reached
When scanning an input, ``flex`` matches this input to the pattern with the
longest character correspondance. With this ``flex`` patterns:
.. code-block::
and with ``<>`` as input, flex will use the ``<>`` pattern.
However, when facing two patterns with the same correspondance length, it uses
the first one (i.e. the one declared first). This is why you should always pay
attention when using regexes that includes other patterns.
.. code-block::
Here, ``while`` pattern is unreachable since it is matched by ``[a-z]+``,
defined first. To be able to distingish these two cases, we need to switch
their declaration order.
......@@ -26,6 +26,8 @@ Relevant lecture notes include :lectures:`08-dev-tools.pdf`,
.. **TC-1 FAQ**: Questions not to ask
.. **TC-1 Recurring Bugs**: Frequently encountered bugs
.. **TC-1 Improvements**: Other Designs
.. toctree::
......@@ -35,4 +37,5 @@ Relevant lecture notes include :lectures:`08-dev-tools.pdf`,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment