$30 off During Our Annual Pro Sale. View Details »
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
560
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
53
Kore
apfohl
0
230
DNSSEC
apfohl
0
170
Domain Name System
apfohl
1
230
FreeBSD
apfohl
0
260
Other Decks in Research
See All in Research
Open Gateway 5GC利用への期待と不安
stellarcraft
2
160
音声感情認識技術の進展と展望
nagase
0
400
Thirty Years of Progress in Speech Synthesis: A Personal Perspective on the Past, Present, and Future
ktokuda
0
120
Sat2City:3D City Generation from A Single Satellite Image with Cascaded Latent Diffusion
satai
4
330
AIスパコン「さくらONE」のLLM学習ベンチマークによる性能評価 / SAKURAONE LLM Training Benchmarking
yuukit
2
900
ドメイン知識がない領域での自然言語処理の始め方
hargon24
1
210
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1k
Remote sensing × Multi-modal meta survey
satai
4
630
【輪講資料】Moshi: a speech-text foundation model for real-time dialogue
hpprc
3
820
「どう育てるか」より「どう働きたいか」〜スクラムマスターの最初の一歩〜
hirakawa51
0
1k
AWSで実現した大規模日本語VLM学習用データセット "MOMIJI" 構築パイプライン/buiding-momiji
studio_graph
2
1k
論文紹介:Safety Alignment Should be Made More Than Just a Few Tokens Deep
kazutoshishinoda
0
150
Featured
See All Featured
Balancing Empowerment & Direction
lara
5
800
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Making Projects Easy
brettharned
120
6.5k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Site-Speed That Sticks
csswizardry
13
1k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
A designer walks into a library…
pauljervisheath
210
24k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
BBQ
matthewcrist
89
9.9k
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