mirror of
https://github.com/Ed94/LangStudies.git
synced 2025-06-15 03:21:46 -07:00
SRegEx works!!!!
Its not a full flegged transpiler but it works at least on RDP's lexer. I can expand on demand.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
## Concatenation
|
||||
|
||||
Regex : `/^AB$/`
|
||||
Psuedo: `start str(AB) end`
|
||||
Regex : `/^AB$/`
|
||||
Psuedo: `start AB end`
|
||||
|
||||
Machine:
|
||||
```
|
||||
@ -12,8 +12,8 @@ Submachine_A --epsilon--> Submachine_B
|
||||
|
||||
## Union
|
||||
|
||||
Regex : `/^A|B$/`
|
||||
Psuedo: `start glyph(A) | glyph(B) end`
|
||||
Regex : `/^A|B$/`
|
||||
Psuedo: `start A | B end`
|
||||
|
||||
Machine:
|
||||
```
|
||||
@ -26,8 +26,8 @@ Machine:
|
||||
|
||||
## Kleene Closure
|
||||
|
||||
Regex : `/^A*$/`
|
||||
Psuedo: `start glyph(A).repeating end`
|
||||
Regex : `/^A*$/`
|
||||
Psuedo: `start A.repeat(0-) end`
|
||||
|
||||
Machine:
|
||||
```
|
||||
|
30
App/RegM/Lectures/Lecture.8.Notes.md
Normal file
30
App/RegM/Lectures/Lecture.8.Notes.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Complex Machines
|
||||
|
||||
Ex:
|
||||
|
||||
RegEx : `/xy*|z`
|
||||
SRegEx: `x y.repeat(0-) | z`
|
||||
|
||||
## Decomposition
|
||||
|
||||
### Stage 1: Union
|
||||
```
|
||||
->o.start (o)
|
||||
\epsilon-> o --xy*-> o -epsilon-->/
|
||||
\epsilon-> o --z---> o -epsilon->/
|
||||
```
|
||||
### Stage 2: Concatenation
|
||||
```
|
||||
->o.start (o)
|
||||
\epsilon -> o --x--> o -epsilon-> o --y* -epsilon->/
|
||||
\epsilon -> o --z--> o -epsilon------------------>/
|
||||
```
|
||||
### Stage 2: Kleene Closure
|
||||
```
|
||||
|<------------<|
|
||||
->epsi -> o -x-> o -epsi-> o -epsi-> o -y-> -epsi-> o ->epsi->|
|
||||
| |>---------------------->| /
|
||||
->o.start (o)
|
||||
\epsi -> o -z-> o -epsi------------------------------------>/
|
||||
```
|
||||
|
11
App/RegM/Lectures/Lecture.9.Notes.md
Normal file
11
App/RegM/Lectures/Lecture.9.Notes.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Syntactic Sugar
|
||||
|
||||
Ex:
|
||||
|
||||
RegEx : `/a+|[0-3]/`
|
||||
SRegEx: `a.repeat(1-) | set(0-3)`
|
||||
|
||||
`A+` === `AA*` === `A.repeat(1-)` === `AA.repeat(0-)`
|
||||
`A?` === `A|ε` === `A.repeat(0-1)`
|
||||
|
||||
`[0-9]` === `0|1|2|3|4|5|6|7|8|9` === `set(0-9)`
|
Reference in New Issue
Block a user