Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

127 Commits

Repository files navigation

1. notes for regular expression

1) syntax tree.

node type in a syntax tree for implementing NFA is described as follow:

symbolnode type
dot(.)Leaf Node
^Head Node
$Tail Node
[]O-Node, option node.
*Star Node
+Star Node
?Star Node
{}Star Node
r1r2Cat Node
r1|r2Or Node
()represent a unit, it will be set as an attribute in the tree node.
\1leaf node, for back reference.
charleaf node represents normal character.

2) usage.

syntaxs of the regular expression supported by my implementation.

  1. all the syntaxs supported are as mentioned in the previous section.
  2. for [], support range and negation, [a-f], [2-9], [^abc].
  3. for back reference, referencing index starts from 0, this is quite different from what you usually see. eg, given pattern: ((ab)cd), for testing string abcd, we get: \0 == ab, \1 == abcd. so, group capturing works inside out.
  4. use {2, 4} to make repetition of the previous unit. eg, (ab){2, 4} means repeating ab 2 to 4 times(inclusive)

2. ink - a toy scripting language modeling the syntax of python and c(ongoing)

About

compiling & parsing

Resources

Stars

13 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages