How does it look like?
The syntax was inspired by LISP and bash. Sounds strange? For example,
(* (+ 2 4 (#FACT 4)) 3)
means (2 + 4 + fact(4)) * 3 where fact is user-defined function for factorial.
As you've probably noticed, DL/SQL has got prefix (polish) notation with compulsory bracketing. That means, in front any name of function there must be opening bracket and after last parameter of a function there must be closing bracket. With this rule it's really easy to implement variable-length argument lists.
As for now, DL/SQL supports only two types: float and list of floats (no lists of lists, etc.).
Lists syntaxThere's special syntax of lists in DL/SQL. The regular (yes, we need just regular expression with simple lists) expression describing the list is:
Well, that doesn't help much, so:
Boolean valuesWhen evaluating logical functions, the input value of TRUE is every non-zero value. Input value of FALSE is 0, 0.0, an empty list and list with one zero member (
Hardcoded functionsHere follows list of functions implemented in DL/SQL.
ConditionThe only function with strict evaluation strategy is
Calling user functionsI wanted the parser to be the simplest one, so there's little hack about calling custom functions. Every name of called user function must have prepended the hash sign (#). So calling custom function called QUICKSORT is done like this:
Defining user functionsBecause the idea of putting everything in the database, we don't need to have semantic construction for defining custom function - we simply put another row into database with correct definition of function body and that's it. :-)
For referencing parameters in function's definition, we can use several ways to do so:
Bash-like parametersFirst parameter is referenced as
Passing all parametersThere's special construction for passing all parameters passed to function to another function. This construction is made through
Selective parameter passingThis one is little hack: sign
Lets say we have function called
(the fact that