- Notifications
You must be signed in to change notification settings - Fork0
SimpleRegex/SRL-CPP
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is a header-only C++ libary for Simple Regex Language.
Currently under development.
You only need to include the library directory and use C++ 14 standard to compile. The namespace used isspre::.
The library uses C++ 11 features heavily, and usesmake_unique from C++ 14. You could use latest Visual Studio, org++-4.9 or later, orclang++-3.8 or later. The project usescmake as the builing system.
// test.cpp#include<string>#include<iostream>#include<spre/spre.hpp>intmain(){ std::string src ="literally\"something\""; spre::SRLsrl(src); std::cout << srl.get_pattern() << std::endl;return0;}
$ tree..|-- test.cpp`-- include`-- spre|-- ast.hpp|-- ... ...$ g++ -I./include -std=c++14 test.cpp$ ./test(?:something)
MIT.
- The
Builderis yet to be implemented. - The error reports are implemented as outputing to
stderr.
First of all, it's designed to be a header-only library. Thus everything are written in the header files (.hpp). Ideally users only need to#include <spre/spre.hpp>.
The library is written as a light-weight compiler-like thing, although SRL is a DSL and does not have control flow (as a subset of Regex) thus could not be considered turing-complete. As a result, this library has lexer and parser and code generator. This library has specific lexer instead of usingyacc. The code is written following the tutorials fromllvm and@frozengene.
The structure:
token.hpp| Vdictionary.hpp ast.hpp | | V Vlexer.hpp ---------> parser.hpp --------> generator.hpp(get tokens) (get (vector of) asts) (get the compiled regex string)| V spre.hpp (`SRL` and `Builder`)
About
C++ implementation of SRL.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.