Skip to content

DanieleParravicini/re2compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

re2compiler

A compiler for a regex coprocessor


How to start?

Very simple!

  1. clone this repo
  2. run pip install -r requirements.txt to fetch required packages
  3. run re2compiler.py

to feed regular expression you can use several options:

  1. using cli input (by not providing a file neither specifying -data)
  2. using a file
  3. using the -data argument
  4. programmatically by recalling compile from another python script as in example.py
import re2compiler

data 	= '(a|b)*'
output	= re2compiler.compile(data=data)
print(output)

screen shot example

Optional arguments:

option description example
-h, --help show this help message and exit
-data [DATA] allows to pass the input string representing the regular expression directly via parameter .
-dotast DOTAST save abstract syntax tree representation using dot format in the given file. abstract syntax tree example
-dotirlowered DOTIRLOWERED save ir representation using dot format in the given file. ir
-dotcode DOTCODE save a code representatio using dot format in the given file. code
-o [O] output file containing the code that represent the regular expression.
-O1 perform simple optimization optimized code

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Releases

No releases published

Packages

No packages published