GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SimpleRegex/SRL-CPP: C++ implementation of SRL.

This repository was archived by the owner on Jun 9, 2025. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

13 Commits
13 Commits

Folders and files

NameName
Last commit message
Last commit date
include/spre
include/spre
 
 
test
test
 
 
.clang-format
.clang-format
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

SRL-CPP

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 is spre::.

The library uses C++ 11 features heavily, and uses make_unique from C++ 14. You could use latest Visual Studio, or g++-4.9 or later, or clang++-3.8 or later. The project uses cmake as the builing system.

// test.cpp
#include <string>
#include <iostream>
#include <spre/spre.hpp>
int main()
{
    std::string src = "literally \"something\"";
    spre::SRL srl(src);
    std::cout << srl.get_pattern() << std::endl;
    return 0;
}
$ tree .
.
|-- test.cpp
`-- include
    `-- spre
        |-- ast.hpp
        |-- ...
        ...

$ g++ -I./include -std=c++14 test.cpp
$ ./test
(?:something)

License

MIT.

Limitations and TODOs

  • The Builder is yet to be implemented.
  • The error reports are implemented as outputing to stderr.

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 using yacc. The code is written following the tutorials from llvm and @frozengene.

The structure:

token.hpp
  |
  V
dictionary.hpp         ast.hpp
  |                       |  
  V                       V
lexer.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

Readme
License
Activity
Custom properties

Stars

6 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.