All Questions
4 questions
0
votes
1
answer
322
views
Lexical Analysis - Extraction tokens from DFA constructed directly
I've been reading the dragon book and was really interested in the algorithm that converts a regex directly to a DFA (without an explicit NFA). Suppose my lexical file layout is like lex:
...
%%
if ...
1
vote
1
answer
74
views
Compiler Construction - Why does some tokens requires a final state with a backtrack?
So i'm studying compiler construction for an exam , but there seems something i can't understand.
Let's assume the following set of terminals:
T = {:, *, =, (, ), <, >, {, }, [a..z], [0..9]}
...
10
votes
1
answer
1k
views
DFAs vs Regexes when implementing a lexical analyzer?
(I'm just learning how to write a compiler, so please correct me if I make any incorrect claims)
Why would anyone still implement DFAs in code (goto statements, table-driven implementations) when ...
6
votes
1
answer
5k
views
DFA-based regular expression matching - how to get all matches?
I have a given DFA that represents a regular expression.
I want to match the DFA against an input stream and get all possible matches back, not only the leftmost longest match.
For example:
regex: a*...