Skip to content

Commit

Permalink
specifcy FFI operations
Browse files Browse the repository at this point in the history
  • Loading branch information
divarvel committed Nov 8, 2024
1 parent 05a49da commit 90fbea9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SPECIFICATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ The logic language is described by the following EBNF grammar:
<expression_element> ::= <expression_unary> | (<expression_term> <expression_method>? )
<expression_unary> ::= "!" <sp>? <expression>
<expression_method> ::= "." <method_name> "(" <sp>? (<term> ( <sp>? "," <sp>? <term>)* )? <sp>? ")"
<method_name> ::= ([a-z] | [A-Z] ) ([a-z] | [A-Z] | [0-9] | "_" )*
<method_name> ::= (extern::)?([a-z] | [A-Z] ) ([a-z] | [A-Z] | [0-9] | "_" )*
<expression_term> ::= <term> | ("(" <sp>? <expression> <sp>? ")")
<operator> ::= "<" | ">" | "<=" | ">=" | "===" | "!==" | "&&" | "||" | "+" | "-" | "*" | "/" | "&" | "|" | "^" | "==" | "!=="
Expand Down Expand Up @@ -479,6 +479,7 @@ Here are the currently defined unary operations:
- `bool`
- `set`
- `null`
- *external* call: implementation-defined, allows the datalog engine to call out to a function provided by the host language

Here are the currently defined binary operations:

Expand Down Expand Up @@ -513,6 +514,7 @@ Here are the currently defined binary operations:
- _get_, defined on arrays and maps (v6 only)
on arrays, takes an integer and returns the corresponding element (or `null`, if out of bounds)
on maps, takes either an integer or a string and returns the corresponding element (or `null`, if out of bounds)
- *external* call: implementation-defined, allows the datalog engine to call out to a function provided by the host language

Integer operations must have overflow checks. If it overflows, the expression
fails.
Expand All @@ -521,6 +523,8 @@ Strict equality fails with a type error when trying to compare different types.

Lenient equality returns false when trying to compare different types.

External calls are implementation defined. External calls carry a function name, which can be used to call a user-defined function provided to the biscuit library.

#### Example

The expression `$a + 2 < 4` will translate to the following opcodes: $a, 2, +, 4, <
Expand Down
4 changes: 4 additions & 0 deletions schema.proto
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,11 @@ message OpUnary {
Parens = 1;
Length = 2;
TypeOf = 3;
Ffi = 4;
}

required Kind kind = 1;
optional string ffiName = 2;
}

message OpBinary {
Expand Down Expand Up @@ -182,9 +184,11 @@ message OpBinary {
All = 25;
Any = 26;
Get = 27;
Ffi = 28;
}

required Kind kind = 1;
optional string ffiName = 2;
}

message OpClosure {
Expand Down

0 comments on commit 90fbea9

Please sign in to comment.