Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
/SRL-CPPPublic archive

C++ implementation of SRL.

License

NotificationsYou must be signed in to change notification settings

SimpleRegex/SRL-CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a header-only C++ libary for Simple Regex Language.

Currently under development.

Usage

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)

License

MIT.

Limitations and TODOs

  • TheBuilder is yet to be implemented.
  • The error reports are implemented as outputing tostderr.

Technical Structures

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp