Member-only story
Exploring Life’s Ultimate Question with CEL
The ability to express and evaluate constraints, policies and conditions using a machine-readable language is not something new, the roots lie back in the Advanced Boolean Expression Language which was used in hardware verification.
Below is a sample program for describing the half-adder
module my_first_circuit;
title 'ee200 assignment 1'
EE200XY device 'XC4003E';
" input pins
A, B pin 3, 5;
" output pins
SUM, Carry_out pin 15, 18 istype 'com';
equations
SUM = (A & !B) # (!A & B) ;
Carry_out = A & B;
end my_first_circuit;evolving to software in the Java ecosystem as an Expression Language
<c:if test="${sessionScope.cart.numberOfItems > 0}">
...
</c:if>notice how "${sessionScope.cart.numberOfItems > 0}" expression is represented as a string that allows the user to evaluate a condition depending on the value of numberOfItems in cart object from the session.
Common Expression Language is one such attempt from Google to write a language-agnostic expression language and evaluation engine.
A sample rule from cel-spec
account.balance >= transaction.withdrawal
|| (account.overdraftProtection
&& account.overdraftLimit >= transaction.withdrawal - account.balance)









