Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Event Language
Search
Andreas Pfohl
June 09, 2015
Research
0
460
The Event Language
Rule Based Complex-Event Processing on Distributed Networks
Andreas Pfohl
June 09, 2015
Tweet
Share
More Decks by Andreas Pfohl
See All by Andreas Pfohl
DNSSEC v2
apfohl
0
47
Kore
apfohl
0
210
DNSSEC
apfohl
0
170
Domain Name System
apfohl
1
220
FreeBSD
apfohl
0
220
Other Decks in Research
See All in Research
Rの機械学習フレームワークの紹介〜tidymodelsを中心に〜 / machine_learning_with_r2024
s_uryu
0
190
Pathfinding for 10k agents
kei18
1
3k
リサーチに組織を巻き込むための「準備8割」の話
terasho
0
440
SANER 2019 Most Influential Paper Talk
tsantalis
0
110
Alternative Photographic Processes Reimagined: The Role of Digital Technology in Revitalizing Classic Printing Techniques【SIGGRAPH Asia 2023】
toremolo72
0
410
20240209 データを肴に熊本の交通を考える会「車1割削減、渋滞半減、公共交通2倍」をめざし世界に学ぼう
trafficbrain
0
700
論文紹介 DSRNet: Single Image Reflection Separation via Component Synergy (ICCV 2023)
tattaka
0
160
Schrödinger Bridge問題に基づく拡散生成モデル学習
takeshi_koshizuka
1
520
Experiments on ROP Attack with Various Instruction Set Architectures
yumulab
0
310
コミュニティ、人、関係性 / Community, The Inner World, Relationships
spring_aki
PRO
1
820
「歴史的農業環境閲覧システム」と「迅速測図」について
wata909
1
530
F0に基づいて伸縮された画像文字からの音声合成 [ASJ2024春]
nehi0615
0
110
Featured
See All Featured
Done Done
chrislema
178
15k
What the flash - Photography Introduction
edds
64
11k
Robots, Beer and Maslow
schacon
PRO
154
7.9k
Web Components: a chance to create the future
zenorocha
304
41k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
What's new in Ruby 2.0
geeforr
335
31k
Product Roadmaps are Hard
iamctodd
43
9.6k
In The Pink: A Labor of Love
frogandcode
137
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
153
14k
Typedesign – Prime Four
hannesfritz
36
2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
6
950
Transcript
The Event Language Rule Based Complex-Event Processing on Distributed Networks
Andreas Pfohl and Robert Heumüller June, 9th 2015 1
Setting • Complex-Event Processing • Embedded Networks • Different Architectures
• Varying Computational Power 2
Challenges • High-level language • Runs on different architectures •
Compiled and Just-in-Time-Compiled • Means of distribution 3
Event Processing event PositionEvent { time = [0], pos =
[1] } pos_a; event PositionEvent { time = [2], pos = [6] } pos_b; + event VelocityEvent { v = [2.5] } velocity; 4
Vector Calculation • Vectors for information • Vector Calculator •
Collections Library 5 event PositionEvent { time = [0], pos = [1] } pos_a; f = 1.123; v = [1, 2, f]; s = 3 * v; u = v + s;
Event Language 6 Event Definition: event TimedEvent { time };
event PositionEvent extends TimedEvent { position }; event VelocityEvent { velocity };
Event Language 7 Function Definition: VelocityEvent calculateVelocity(PositionEvent posEv1, PositionEvent posEv2)
:= { velocity = (posEv2.time - posEv1.time)^(-1) * (posEv2.position - posEv1.position) };
Event Language 8 Predicate Definition: predicate positionCheck(PositionEvent posEv1, PositionEvent posEv2)
:= posEv2.position > posEv1.position; predicate timeCheck(PositionEvent posEv1, PositionEvent posEv2) := posEv2.time > posEv1.time;
Event Language 9 Rule Declaration: VelocityRule: [PositionEvent, PositionEvent : positionCheck,
timeCheck] -> calculateVelocity;
Event Language 10 event TimedEvent { time }; event PositionEvent
extends TimedEvent { position }; event VelocityEvent { velocity }; VelocityEvent calculateVelocity(PositionEvent posEv1, PositionEvent posEv2) := { velocity = (posEv2.time - posEv1.time)^(-1) * (posEv2.position - posEv1.position) }; predicate positionCheck(PositionEvent posEv1, PositionEvent posEv2) := posEv2.position > posEv1.position; predicate timeCheck(PositionEvent posEv1, PositionEvent posEv2) := posEv2.time > posEv1.time; VelocityRule: [PositionEvent, PositionEvent : positionCheck, timeCheck] -> calculateVelocity;
Challenges • High-level language • Runs on different architectures •
Compiled and Just-in-Time-Compiled • Means of distribution 11
LLVM • Formerly Low Level Virtual Machine • Compiler Infrastructure
• Compiled and JIT • Different Target Architectures 12
Challenges • High-level language • Runs on different architectures •
Compiled and Just-in-Time-Compiled • Means of distribution 13
Challenges • High-level language • Runs on different architectures •
Compiled and Just-in-Time-Compiled • Means of distribution 14
Challenges • High-level language • Runs on different architectures •
Compiled and Just-in-Time-Compiled • Means of distribution 15
Implementation 16
Overview 17
Lexer / Parser Toolchains: • Lex / Yacc • Flex
/ Bison • Antlr • … 18 Jobs: • Parse Language • Build AST Flex / Lemon
Lemon • Context Free • LALR(1) Parser • Robust Syntax
• Error Handling • LibCollect AST 19 rule_declaration(NODE) ::= TYPE(T) COLON rule_signature(RS) RARROW IDENTIFIER(I). { struct payload *payload = malloc(sizeof(struct payload)); payload->type = N_RULE_DECLARATION; payload->alternative = ALT_RULE_SIGNATURE; payload->rule_declaration.name = strdup(T); payload->rule_declaration.identifier = strdup(I); NODE = tree_create_node(payload, 1, RS); }
Scoping 20 VelocityEvent calculateVelocity(PositionEvent posEv1, …) := …
Linking 21 Resolve References
Validation • Parser: Syntactic Validity • Validation: Semantic Validity •
Check: • References Resolved • Type Constraints 22 Unexpected Behavior Invalid Input
Type Checking 23 Assert: Function_Definition.Expression == EVENT Assert: Initializer.Value ==
NUMBER
Code Generation Tasks: • For each event: • Structure definition
• For each Predicate / Function: • Function • For each Rule: • Activation Function • Processing Function 24 Options: • C • “Highlevel” • Complex • No JIT • Assembler • Lowlevel • Less Complex • Plattform Specific LLVM is Middle Ground
LLVM • Intermediate Representation • Provides Optimizer • C-API 25
Meets all Requirements
LLVM-IR 26 %PositionEvent = type <{ i16, double*, i16, double*
}> %VelocityEvent = type <{ i16, double* }> define %VelocityEvent* @VelocityRule_function(%PositionEvent*, %PositionEvent*) { %3 = call %VelocityEvent* @calculateVelocity(%PositionEvent* %0, %PositionEvent* %1) ret %VelocityEvent* %3 } define %VelocityEvent* @calculateVelocity(%PositionEvent*, %PositionEvent*) { %3 = alloca %VelocityEvent* %malloccall = tail call i8* @malloc(i32 ptrtoint (%VelocityEvent* getelementptr (%VelocityEvent* null, i32 1) to i32)) %4 = bitcast i8* %malloccall to %VelocityEvent* %5 = getelementptr inbounds %VelocityEvent* %4, i32 0, i32 0 %6 = alloca double %7 = alloca <{ i16, double* }> %8 = getelementptr inbounds <{ i16, double*
Conclusion • Rule-Based language for Event-Processing • Created complete compiler
toolchain • Knowledge about compiler construction • Improved low level programming and understanding 27
28 Demo - Creating Event-Processor
Demo - Using Event-Processor