📄 readme
字号:
This is a regular expressions library. It is based on a decouplingof the surface syntax used to specify regular expressions and thebackend engine that implements the matcher. An abstract syntax is usedto communicate between the front end and the back end of the system, USING REGULAR EXPRESSIONSGiven a structure S1 describing a surface syntax and a structure S2 describing a matching engine, a regular expression package can bedefined by applying the functor: RegExpFn (structure P=S1 structure E=S2) : REGEXPTo match a regular expression, one first needs to compile arepresentation in the surface syntax. The type of a compiled regularexpression is given in the REGEXP signature as: type regexpTwo functions are provided inthe REGEXP signature: val compile : (char,'a) StringCvt.reader -> (regexp, 'a) StringCvt.reader val compileString : string -> regexp The function compile is a regexp reader, while compileString isspecialized to strings.Once a regular expression has been compiled, three functions areprovided to perform the matching: val find : val prefix : [[ See types in Glue/regexp-sig.sml ]] val match : The function find returns a reader that searches a stream and attemptsto match the given regular expression. The function prefix returns areader that attempts to match the regular expression at the currentposition in the stream. The function match takes a list of regularexpressions and functions and returns a reader that attempts to matchone of the regular expressions at the current position in thestream. The function corresponding to the matched regular expressionis invoked on the matching information. MATCHING INFORMATIONOnce a match is found, it is returned as a match_tree datatype(defined in Glue/match-tree.sml). This is a hierarchical structuredescribing the matches of the various subexpressions appearing in thematched regular expression. A match for an expression is a recordcontaining the position of the match and its length. The root of thestructure always described the outermost match (the whole stringmatched by the regular expression). See the file Glue/match-tree.smlfor more details. ROADMAPFrontEnd/ Implementation of various surface syntaxesBackEnd/ Implementation of various matching enginesGlue/ Glue code FRONT ENDSA single surface syntax is currently implemented, providing an AWKsyntax to describe regular expressions. See the fileFrontEnd/awk-syntax.sml for a description of the actual syntax. BACK ENDSTwo matching engines are implemented:1) A backtracking engine (BackEnd/bt-engine.sml), that provides full submatching information. Slow, low memory footprint, low startup cost. 2) An automaton-based engine (BackEnd/dfa-engine.sml), that provides only top-level matching information (the string matched). Fast, but memory-intensive and high startup cost (the cost of constructing the automaton in the first place)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -