MyLex is a tiny lexical analyzer implemented in C++ and it is my home work of compiler.
- parse .mylex file
- generate a list of NFA by the regex strings
- generate a large NFA by combining the NFAs
- convert the NFA to a DFA
- minimize the DFA
- generate the c code from DFA
- convert regex to postfix expression
- convert postfix expression to NFA, reference
- convert NFA to DFA
- minimize DFA
- OS: Linux , Unix or Mac OS
- Compiler: g++ or clang
- Library: Boost
- OS: Linux , Unix or Mac OS
- Compiler: gcc or clang, Must Use Compilers Which Support C99
For Debug
make DEBUG=1
Not For Debug
make
mylex infile [outfile](default output to stdout)
make
./mylex sample/c_lex.mylex > c_lex.c
make c_lex
- Sample: c_lex.mylex
- Sample Input: sample.c
- Sample Output: sample.out
File Format
[N] the number of entries
[Entry]
[Entry]
...
Entry Format
[Regex]
[Handler] with the param (shm_str)
========= (at least 4 '=')