SlideShare a Scribd company logo
A " Do-It-Yourself "
Specification Language
with
Sylvain Hallé
by
CRSNG
NSERC
EventsEvents are arbitrary data
elements produced in a sequence
called a stream. Any Java object can
be used as an event.
2
3
4
π abc
3 8 a
3 8 a
2 6 c
+
⊇?
<a><a><a>
Numbers Strings XML
documents
Booleans
Tuples Functions Sets Plots
⊇?
3
4
FunctionsFunctions
1:1
function
2:1
function
6
6 0:1
function
transform events into other events.
Function
Applies a function to
every input event
Cumulative
Computes the
progressive "sum" of
all input events
Trim
Removes the first n
input events
Decimate
Outputs every
n-th event
Group
Encloses a group of
connected processors
Fork
Duplicates a stream
into multiple copies
Slice
Splits a stram into multiple
sub-streams
Window
Applies a function to
a sliding window of
n events
ProcessorsProcessors are simple computing
units that transform input streams into output
streams. BeepBeep's core is made of a handful of
general purpose processors.
f
Σ f
n
Filter
A first, Boolean stream, decides if each
event of a second stream should be output
{
f
PipingPiping the output of processors to the
input of others creates a chain that produces
the desired computation.
Any output can be connected to any input,
as long as they have the same type. Many types
can occur in the same chain. The final output
of the chain can be of any type, too.
Fork f = new Fork(2);
FunctionProcessor sum =
new FunctionProcessor(Addition.instance);
CountDecimate decimate = new CountDecimate(n);
Connector.connect(fork, LEFT, sum, LEFT)
. connect(fork, RIGHT, decimate, INPUT)
. connect(decimate, OUTPUT, sum, RIGHT);
Pullable p = sum.getOutputPullable(OUTPUT);
while (p.hasNext() != NextStatus.NO) {
Object o = p.next();
. ..
}
n
→
→
→
+
→
→
→
→
→
f
1 LOC per vertex
1 LOC per edge
They can contain arbitrary Java code, member
fields, etc. "What happens in the box remains in
the box."
CustomCustom processors and functions can
be created by inheriting from the basic Processor
and Function objects provided by BeepBeep.
class Counter extends UniformProcessor {
int cnt = 0;
public Counter() {
super(1,1);
}
public void compute(Object[] in, Queue<> out) {
cnt++;
out.add(new Object[]{cnt});
}
}
PalettesPalettes are groups of functions and
processors centered around a particular use case.
They represent a simple, but powerful way of
extending BeepBeep to a user's needs. A few of
the palettes available so far:
XML events
Plotting
Finite-state machines
Temporal logic
Signal processing
Various log formats
Networking
...create your own
1 2 3 4 5
Σ
0
+6
...2 7 1 8 2
f
1
Σ
0
+
Σ
0
+
÷
1
x,
y
x
+
t
+
x
1
Σ
0
+
½ s
x
4
{
4
4
x̅
→
A
/a/b
//character[status=Walker]/id/text()
→ p1
→
A
→ p2
→ →
→
→
/a/b
→
→
→
3
→
→
→
<?
→
→
→
→
→
→
→
→
f1
f2
→
→ →
→
→
→
→
//character[status=Blocker]/id/text()
→
→
*
*
*
*
Create Auction
=?
0
@
Last Price
Days
0:=
3@Max. Days :=Min. Price 2@:=
Days :=
Days 1
+
End of Day
=?
0
@
>
<?
Days
Last Price
2
@:=
Bid
=?
0
@
>
Min. Price
<?
2
@
Last Price
>?
2
@
Bid
=?
0
@
>
Last Price
>?
2
@
Days :=
Days 1
+
End of Day
=?
0
@
Max. Days
→
End of Day
*
1@
*
→
→→
→
*
Sold
=?
0
@
Days
Days
+ | |.÷
→→
→
→
SELECT
@0 AS x
@1 AS y
→→
+
0
Σ→ →1
→
→→
∅ +=
Σ
→
→
x
4
f
Σ
0
+
GroupGroup processors encapsulate a chain
of processors; they can have arguments.
→
→
x
4
f
Σ
0
+
GroupGroup processors encapsulate a chain
of processors; they can have arguments.
→
→
x
4
Σ
0
+f
GroupGroup processors encapsulate a chain
of processors; they can have arguments.
?
? ??
foo
GroupGroup processors encapsulate a chain
of processors; they can have arguments.
BeepBeep provides a runtime parser
called Bullwinkle.
It comes with no grammar!
You can define your own, along
with a parse tree visitor, to
create your own BeepBeep
domain-specific language.
<Processor> := <CountDecimate> | <CumulativeSum>
| <Mutator> | <QueueSource> ;
<CountDecimate> := Take one every <Number> from <Processor> ;
<CumulativeSum> := Accumulate <Processor> ;
<Mutator> := Turn <Processor> into <Number> ;
<QueueSource> := [ <Number> , <Number> , <Number> ] ;
<Number> := ^[d]+;
Step 1Step 1
Define a grammar in BNF.
class MyInterpreter extends ExpressionParser<Processor> {
public void doCountDecimate(Stack<Object> stack) {
Processor p = (Processor) stack.pop();
stack.pop(); // from
Constant n = (Constant) stack.pop();
stack.pop(); // every
stack.pop(); // one
stack.pop(); // Take
CountDecimate dec = new CountDecimate(
((Number) n.getValue()).intValue());
Connector.connect(p, dec);
m_builtObject.addProcessor(dec);
stack.push(dec);
}
...
}
Step 2Step 2
Create an ExpressionParser, with a method
doXXX for every non-terminal symbol xxx you
want to handle.
MyInterpreter my_int = new MyInterpreter();
Processor proc = my_int.parse(
"Take one every 2 from The sum of [3, 4, 6]");
SomeOtherProcessor op = ..
Connector.connect(proc, op);
...
Step 3Step 3
Enjoy!
3 4
Σ
0
+6
2
Can be used to pipe together any
processor and/or function
...including those you define yourself
...(that may contain arbitrary Java code)
...and only those you want to include
...from any existing palette
...using a syntax you choose
An easy way to create simple
languages that do complex things
https://liflab.github.io/beepbeep-3
.../beepbeep-3-examples

More Related Content

PDF
BeepBeep 3: A declarative event stream query engine (EDOC 2015)
PDF
Activity Recognition Through Complex Event Processing: First Findings
PDF
When RV Meets CEP (RV 2016 Tutorial)
PDF
A formalization of complex event stream processing
PPTX
Queue oop
PPT
Whats new in_csharp4
PDF
The Ring programming language version 1.8 book - Part 86 of 202
PPT
FSE 2008
BeepBeep 3: A declarative event stream query engine (EDOC 2015)
Activity Recognition Through Complex Event Processing: First Findings
When RV Meets CEP (RV 2016 Tutorial)
A formalization of complex event stream processing
Queue oop
Whats new in_csharp4
The Ring programming language version 1.8 book - Part 86 of 202
FSE 2008

What's hot (20)

DOCX
Pratik Bakane C++
PDF
C++ programs
PDF
C++ Programming - 2nd Study
DOCX
Pratik Bakane C++
DOCX
Pratik Bakane C++
PPT
Lecture05
DOCX
Pratik Bakane C++
DOCX
Pratik Bakane C++
PDF
Nesting of for loops using C++
PDF
Python meetup: coroutines, event loops, and non-blocking I/O
PPTX
TCO in Python via bytecode manipulation.
PDF
Python opcodes
PDF
Faster Python, FOSDEM
PDF
Data Structure - 2nd Study
PDF
Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"
PDF
C++ Programming - 4th Study
PDF
C++ Programming - 3rd Study
PPT
Cpp tutorial
PDF
All I know about rsc.io/c2go
Pratik Bakane C++
C++ programs
C++ Programming - 2nd Study
Pratik Bakane C++
Pratik Bakane C++
Lecture05
Pratik Bakane C++
Pratik Bakane C++
Nesting of for loops using C++
Python meetup: coroutines, event loops, and non-blocking I/O
TCO in Python via bytecode manipulation.
Python opcodes
Faster Python, FOSDEM
Data Structure - 2nd Study
Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"
C++ Programming - 4th Study
C++ Programming - 3rd Study
Cpp tutorial
All I know about rsc.io/c2go
Ad

Similar to A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017) (20)

PDF
Mining event streams with BeepBeep 3
PDF
Writing Domain-Specific Languages for BeepBeep
PDF
GPars For Beginners
PDF
Gpars - the coolest bits
PDF
DFiant HDL CIRCT Presentation
PDF
Glutter – A Visual Programming Environment for Complex Event Processing
PDF
Building a DSL with GraalVM (CodeOne)
PDF
Scala Paradigms
PDF
Event Stream Processing with BeepBeep 3
PDF
Building a DSL with GraalVM (VoxxedDays Luxembourg)
PDF
Groovy concurrency
ODP
Open Source Compiler Construction for the JVM
PDF
Is there a perfect data-parallel programming language? (Experiments with More...
PDF
concurrency with GPars
PDF
TI1220 Lecture 9: Parsing & interpretation
PDF
Deklarative Smart Contracts
PDF
Interpreter Case Study - Design Patterns
PDF
GR8Conf 2011: GPars
PDF
Advanced Debugging Using Java Bytecodes
PDF
A Survey of Concurrency Constructs
Mining event streams with BeepBeep 3
Writing Domain-Specific Languages for BeepBeep
GPars For Beginners
Gpars - the coolest bits
DFiant HDL CIRCT Presentation
Glutter – A Visual Programming Environment for Complex Event Processing
Building a DSL with GraalVM (CodeOne)
Scala Paradigms
Event Stream Processing with BeepBeep 3
Building a DSL with GraalVM (VoxxedDays Luxembourg)
Groovy concurrency
Open Source Compiler Construction for the JVM
Is there a perfect data-parallel programming language? (Experiments with More...
concurrency with GPars
TI1220 Lecture 9: Parsing & interpretation
Deklarative Smart Contracts
Interpreter Case Study - Design Patterns
GR8Conf 2011: GPars
Advanced Debugging Using Java Bytecodes
A Survey of Concurrency Constructs
Ad

More from Sylvain Hallé (20)

PDF
A Tree-Based Definition of Business Process Conformance (Talk @ EDOC 2024)
PDF
Monitoring Business Process Compliance Across Multiple Executions with Stream...
PDF
A Stream-Based Approach to Intrusion Detection
PDF
Smart Contracts-Enabled Simulation for Hyperconnected Logistics
PDF
Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning
PDF
Synthia: a Generic and Flexible Data Structure Generator (Long Version)
PDF
Test Sequence Generation with Cayley Graphs (Talk @ A-MOST 2021)
PDF
Efficient Offline Monitoring of LTL with Bit Vectors (Talk at SAC 2021)
PDF
A Generic Explainability Framework for Function Circuits
PDF
Detecting Responsive Web Design Bugs with Declarative Specifications
PDF
Streamlining the Inclusion of Computer Experiments in Research Papers
PDF
Real-Time Data Mining for Event Streams
PDF
Technologies intelligentes d'aide au développement d'applications web (WAQ 2018)
PDF
LabPal: Repeatable Computer Experiments Made Easy (ACM Workshop Talk)
PDF
Event Stream Processing with Multiple Threads
PDF
A Few Things We Heard About RV Tools (Position Paper)
PDF
Solving Equations on Words with Morphisms and Antimorphisms
PDF
Runtime monitoring de propriétés temporelles par (streaming) XML
PDF
La quantification du premier ordre en logique temporelle
PDF
Decentralized Enforcement of Artifact Lifecycles
A Tree-Based Definition of Business Process Conformance (Talk @ EDOC 2024)
Monitoring Business Process Compliance Across Multiple Executions with Stream...
A Stream-Based Approach to Intrusion Detection
Smart Contracts-Enabled Simulation for Hyperconnected Logistics
Test Suite Generation for Boolean Conditions with Equivalence Class Partitioning
Synthia: a Generic and Flexible Data Structure Generator (Long Version)
Test Sequence Generation with Cayley Graphs (Talk @ A-MOST 2021)
Efficient Offline Monitoring of LTL with Bit Vectors (Talk at SAC 2021)
A Generic Explainability Framework for Function Circuits
Detecting Responsive Web Design Bugs with Declarative Specifications
Streamlining the Inclusion of Computer Experiments in Research Papers
Real-Time Data Mining for Event Streams
Technologies intelligentes d'aide au développement d'applications web (WAQ 2018)
LabPal: Repeatable Computer Experiments Made Easy (ACM Workshop Talk)
Event Stream Processing with Multiple Threads
A Few Things We Heard About RV Tools (Position Paper)
Solving Equations on Words with Morphisms and Antimorphisms
Runtime monitoring de propriétés temporelles par (streaming) XML
La quantification du premier ordre en logique temporelle
Decentralized Enforcement of Artifact Lifecycles

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
A Presentation on Artificial Intelligence
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Building Integrated photovoltaic BIPV_UPV.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
Empathic Computing: Creating Shared Understanding
Digital-Transformation-Roadmap-for-Companies.pptx
A Presentation on Artificial Intelligence
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
“AI and Expert System Decision Support & Business Intelligence Systems”
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

A "Do-It-Yourself" Specification Language with BeepBeep 3 (Talk @ Dagstuhl 2017)

  • 1. A " Do-It-Yourself " Specification Language with Sylvain Hallé by CRSNG NSERC
  • 2. EventsEvents are arbitrary data elements produced in a sequence called a stream. Any Java object can be used as an event. 2 3 4 π abc 3 8 a 3 8 a 2 6 c + ⊇? <a><a><a> Numbers Strings XML documents Booleans Tuples Functions Sets Plots
  • 4. Function Applies a function to every input event Cumulative Computes the progressive "sum" of all input events Trim Removes the first n input events Decimate Outputs every n-th event Group Encloses a group of connected processors Fork Duplicates a stream into multiple copies Slice Splits a stram into multiple sub-streams Window Applies a function to a sliding window of n events ProcessorsProcessors are simple computing units that transform input streams into output streams. BeepBeep's core is made of a handful of general purpose processors. f Σ f n Filter A first, Boolean stream, decides if each event of a second stream should be output { f
  • 5. PipingPiping the output of processors to the input of others creates a chain that produces the desired computation. Any output can be connected to any input, as long as they have the same type. Many types can occur in the same chain. The final output of the chain can be of any type, too.
  • 6. Fork f = new Fork(2); FunctionProcessor sum = new FunctionProcessor(Addition.instance); CountDecimate decimate = new CountDecimate(n); Connector.connect(fork, LEFT, sum, LEFT) . connect(fork, RIGHT, decimate, INPUT) . connect(decimate, OUTPUT, sum, RIGHT); Pullable p = sum.getOutputPullable(OUTPUT); while (p.hasNext() != NextStatus.NO) { Object o = p.next(); . .. } n → → → + → → → → → f 1 LOC per vertex 1 LOC per edge
  • 7. They can contain arbitrary Java code, member fields, etc. "What happens in the box remains in the box." CustomCustom processors and functions can be created by inheriting from the basic Processor and Function objects provided by BeepBeep. class Counter extends UniformProcessor { int cnt = 0; public Counter() { super(1,1); } public void compute(Object[] in, Queue<> out) { cnt++; out.add(new Object[]{cnt}); } }
  • 8. PalettesPalettes are groups of functions and processors centered around a particular use case. They represent a simple, but powerful way of extending BeepBeep to a user's needs. A few of the palettes available so far: XML events Plotting Finite-state machines Temporal logic Signal processing Various log formats Networking ...create your own
  • 9. 1 2 3 4 5 Σ 0 +6 ...2 7 1 8 2 f 1 Σ 0 + Σ 0 + ÷
  • 12. → A /a/b //character[status=Walker]/id/text() → p1 → A → p2 → → → → /a/b → → → 3 → → → <? → → → → → → → → f1 f2 → → → → → → → //character[status=Blocker]/id/text()
  • 13. → → * * * * Create Auction =? 0 @ Last Price Days 0:= 3@Max. Days :=Min. Price 2@:= Days := Days 1 + End of Day =? 0 @ > <? Days Last Price 2 @:= Bid =? 0 @ > Min. Price <? 2 @ Last Price >? 2 @ Bid =? 0 @ > Last Price >? 2 @ Days := Days 1 + End of Day =? 0 @ Max. Days → End of Day * 1@ * → →→ → * Sold =? 0 @ Days Days + | |.÷ →→ → → SELECT @0 AS x @1 AS y →→ + 0 Σ→ →1 → →→ ∅ += Σ
  • 14. → → x 4 f Σ 0 + GroupGroup processors encapsulate a chain of processors; they can have arguments.
  • 15. → → x 4 f Σ 0 + GroupGroup processors encapsulate a chain of processors; they can have arguments.
  • 16. → → x 4 Σ 0 +f GroupGroup processors encapsulate a chain of processors; they can have arguments.
  • 17. ? ? ?? foo GroupGroup processors encapsulate a chain of processors; they can have arguments.
  • 18. BeepBeep provides a runtime parser called Bullwinkle. It comes with no grammar! You can define your own, along with a parse tree visitor, to create your own BeepBeep domain-specific language.
  • 19. <Processor> := <CountDecimate> | <CumulativeSum> | <Mutator> | <QueueSource> ; <CountDecimate> := Take one every <Number> from <Processor> ; <CumulativeSum> := Accumulate <Processor> ; <Mutator> := Turn <Processor> into <Number> ; <QueueSource> := [ <Number> , <Number> , <Number> ] ; <Number> := ^[d]+; Step 1Step 1 Define a grammar in BNF.
  • 20. class MyInterpreter extends ExpressionParser<Processor> { public void doCountDecimate(Stack<Object> stack) { Processor p = (Processor) stack.pop(); stack.pop(); // from Constant n = (Constant) stack.pop(); stack.pop(); // every stack.pop(); // one stack.pop(); // Take CountDecimate dec = new CountDecimate( ((Number) n.getValue()).intValue()); Connector.connect(p, dec); m_builtObject.addProcessor(dec); stack.push(dec); } ... } Step 2Step 2 Create an ExpressionParser, with a method doXXX for every non-terminal symbol xxx you want to handle.
  • 21. MyInterpreter my_int = new MyInterpreter(); Processor proc = my_int.parse( "Take one every 2 from The sum of [3, 4, 6]"); SomeOtherProcessor op = .. Connector.connect(proc, op); ... Step 3Step 3 Enjoy! 3 4 Σ 0 +6 2
  • 22. Can be used to pipe together any processor and/or function ...including those you define yourself ...(that may contain arbitrary Java code) ...and only those you want to include ...from any existing palette ...using a syntax you choose An easy way to create simple languages that do complex things https://liflab.github.io/beepbeep-3 .../beepbeep-3-examples