Skip to content

A concept of a language compiler generator based of json instruction files

License

Notifications You must be signed in to change notification settings

saisua/Language

Repository files navigation

Language

A concept of a language compiler generator based of json instruction files

NOTE: Everithing in this README is REALLY outdated. I don't use Hyperscan anymore
https://godbolt.org/z/sG1vE9jdY Objective: https://godbolt.org/z/YGj16YxxW

Requires a local compilation of intel hyperscan*


Results: (timings in the end)


if(var1>10):
Start scan:
 Match for pattern 377 : if\s*\(\s*(not\s)?\s*([A-Za-z][\w\d]*?)(\s*>\s*(not\s)?\s*\d+\s*)+\s*\)\s*:

(Not working yet, known bug)
if ( var1 > 10 and 3<40):
Start scan:

(Not working yet, known bug)
if ( var1 > 10 and var2 == var3 and 3<40 ) :
Start scan:
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 8 : (\w+)\s+([A-Za-z][\w\d]*?)\s*=\s*.+

if var1>10:
Start scan:
 Match for pattern 289 : if\s+(not\s)?\s*([A-Za-z][\w\d]*?)(\s*>\s*(not\s)?\s*\d+\s*)+\s*:

(Not working yet, known bug)
if var1 > 10 and 3<40:
Start scan:

(Not working yet, known bug)
if var1 > 10 and var2 == var3 and 3<40 :
Start scan:
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 8 : (\w+)\s+([A-Za-z][\w\d]*?)\s*=\s*.+

while(var1>10):
Start scan:
 Match for pattern 553 : while\s*\(\s*(not\s)?\s*([A-Za-z][\w\d]*?)(\s*>\s*(not\s)?\s*\d+\s*)+\s*\)\s*:

(Not working yet, known bug)
while ( var1 > 10 and 3<40):
Start scan:

(Not working yet, known bug)
while ( var1 > 10 and var2 == var3 and 3<40 ) :
Start scan:
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 8 : (\w+)\s+([A-Za-z][\w\d]*?)\s*=\s*.+

while var1>10:
Start scan:
 Match for pattern 465 : while\s+(not\s)?\s*([A-Za-z][\w\d]*?)(\s*>\s*(not\s)?\s*\d+\s*)+\s*:

(Not working yet, known bug)
while var1 > 10 and 3<40:
Start scan:

(Not working yet, known bug)
while var1 > 10 and var2 == var3 and 3<40 :
Start scan:
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 8 : (\w+)\s+([A-Za-z][\w\d]*?)\s*=\s*.+

a = 10
Start scan:
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+

a=19
Start scan:
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+

int a = 10
Start scan:
 *Match for pattern 2 : (int)\s+([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 8 : (\w+)\s+([A-Za-z][\w\d]*?)\s*=\s*.+

int a=19
Start scan:
 *Match for pattern 2 : (int)\s+([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 1 : ([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 8 : (\w+)\s+([A-Za-z][\w\d]*?)\s*=\s*.+

const int a = 123
Start scan:
 Match for pattern 34 : (const\s+)+(\w+)\s+([A-Za-z][\w\d]*?)\s*=\s*.+
 *Match for pattern 10 : (const\s+)+(int)\s+([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 2 : (int)\s+([A-Za-z][\w\d]*?)\s*=\s*.+

const int a=124
Start scan:
 Match for pattern 34 : (const\s+)+(\w+)\s+([A-Za-z][\w\d]?)\s*=\s*.+
 *Match for pattern 10 : (const\s+)+(int)\s+([A-Za-z][\w\d]*?)\s*=\s*.+
 Match for pattern 2 : (int)\s+([A-Za-z][\w\d]*?)\s*=\s*.+
 ...

+ Timings: (prints disabled)
 File reading time: Depends of language file sizes
 JSON parsing time: Depends of language file sizes
 Regex extraction time: 1905308ns
 HS database compilation time (n regex): 1203183ns
 Regex matching time (18 tests): 35210ns
 Regex matching time (avg): 1956ns

About

A concept of a language compiler generator based of json instruction files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages