Logical operators priority with NAND, NOR, XNOR - operators

I've searched the web but I've found no solution to this problem.
What is the logical priority for operators NAND, NOR and XNOR?
I mean, considering as example the expression
A AND B NAND C
which operator should be evaluated first?
Obviously NAND can be translated as NOT-AND (as NOR is NOT-OR and XNOR is NOT-XOR), but
(A AND B) NAND C != A AND (B NAND C) = A AND NOT(B AND C)
According to my researches there's no a defined priority for such an expression, so I think the simplest solution is to evaluate the operators according to the order they appear in the expression, but I may be wrong.
Any suggestions?

This actually depends on your precedence rules. If there is no order (no precedence rules or everything of the same importance), it should be solved left to right. Here is an example with C++.

operator precedence have to be defined by a language, and what you have here doesn't seem to be a formal language, in such cases it's often assumed to be evaluated as you read from left to right.
Though, you could use the same operator precedence as verilog , or look at wikipedia which has a small table precedence commonly used for logic operators

If the expression is written like the way it is mentioned in the question(without brackets in between), it should be solved in the order they are written. Thats the only correct way to do this.
eg. If its written line A NOR B XOR C, It simply means (A NOR B) XOR C

Boolean operators have analogues in conventional arithmetic, so one way of deciding what the precedence rules should be is to follow the rules for conventional arithmetic, e.g. AND is analogous to multiplication, while OR is analogous to addition, hence AND should have higher precedence than OR. If you look at the operator precedence table for a language such as C or C++ you will see that this is indeed the case in these and other related languages.

I suppose this could be language specific, ALL operators must have an order of precedence defined or implied by a specific implmentation.
Here is what another site has to say about that.

Related

Arity of BETWEEN expression

What is the arity of the sql BETWEEN expression? I thought it was three (ternary) since the expression usually looks like:
WHERE...
1 BETWEEN 2 AND 3
But it's listed as binary on BigQuery's documentation, and I assume other places as well.
Source: Operators.
What is the arity of the BETWEEN expression and why? I think the answer is 3 from the following example:
select
~ (SELECT -1 AS expr_1) AS 'bitwise_arity_1',
(SELECT 1 AS expr_1) * (SELECT 2 AS expr_2) AS 'times_arity_2',
(SELECT 1 AS expr_1) BETWEEN
(SELECT 2 AS expr_2) AND (SELECT 3 AS expr_3) AS 'bitwise_arity_3?'
I suppose one way to interpret it might just be that the grammar is:
expr 'BETWEEN' logicalAndExpr
And so the two expressions in the logicalAnd are just grouped into one. Is that a correct understanding?
SQLFiddle: http://www.sqlfiddle.com/#!9/b28da2/2156
It's binary, in syntactic terms. See below for a discussion of syntax vs. semantics, where I note that a better syntactic term is "infix".
Similarly, function calls and array subscripting are postfix unary operators and the C family's conditional operator (often misnamed "the ternary operator" as though it were the only such thing) is also infix. The reason is that the interior operands (the operands between BETWEEN...AND, (...), [...], and ?...:, respectively) are fenced off from the rest of the syntax by the pair of surrounding terminal tokens which function as a syntactic barrier, like parentheses. Precedence does not penetrate to the enclosed operands; only the outer operand(s) remain floating in the syntax.
The semantic view is quite different, of course. BETWEEN...AND and ?...: are certainly three-argument functions, although since the latter is short-circuiting, only two of the three arguments are ever evaluated, which makes it hard to discuss in strict mathematical terms [Note 1]. Moreover, the semantic view is complicated by the fact that there is not just a single way to look at what an argument is. As noted in a comment, you can always curry functions into a series of unary applications of higher-order functions. Although you might be tempted to try to redefine "arity" as the length of that sequence, you will soon find higher-order functions which have different sequence lengths depending on the values of their arguments. Also, in most programming languages (unlike SQL) the function being called is a full expression which does not need to be evaluated at compile-time, and since different functions have different argument counts, there is no good way to describe the arity of a function call unless you respecify the call to be the application of a list-of-arguments object to a callable object. That's often done, but it's a bit unsatisfying because (in most languages), the list object does not really exist and cannot be observed as an object.
I'd suggest taking the Wikipedia article on arity with a good-sized saline dosage, because it completely misses the distinction between semantics and syntactic structure, giving rise to the confusing ambiguity between the semantic and syntactic view of SQL's range operator or C's conditional operator. Personally, I prefer to reserve "arity" for the semantic meaning, using "fixity" or "valence" for the syntactic feature. (The advantage of "fixity" is that it encourages the distinction between prefix and postfix, which is a real distinction hidden by calling both cases "unary operators".)
Notes
BETWEEN...AND could short-circuit, too, but standard SQL doesn't guarantee short-circuiting, as far as I know (although some SQL implementations do.)

How is the xx operator in Raku able to delay the evaluation of its left-hand side code operand?

The 'xx' operator is interesting in that this:
(^100).pick xx 10
produces a list of 10 random Int's rather than one random Int repeated 10 times as a list.
Is the operator handled as a special case by the compiler? Or is it really just another sub that we can define ourselves too? (If so, I'd be very interested to know how...)
Thanks
Yes, this is one of a range of operators that currently exist as special forms in the compiler. Other examples include || and &&, which only evaluate the right hand side depending on the boolification of the left hand side.
At present, there's not a way to define such an operator yourself (or at least, not an officially supported one; if prepared to tinker in compiler internals all things are possible). However, macros - planned for the next major Raku language version - will enable this.

Is it, and if so why, wrong that these two regular grammars are different?

I'm tasked with writing a regular grammar based on a regular expression.
Given the regular expression a*b can be written as S -> b | aS
Is it incorrect that ba* as a regular grammar is S -> b | Sa?
I'm told the correct answer is in fact S -> bA, A -> ^| aA but I don't see the difference myself.
An explanation would be greatly appreciated!
IIRC, both your answer and the one being called "correct" are correct. See this. What you have constructed is a "left regular grammar", while the proponent(s) of the "correct" answer obviously prefer a "right regular grammar". There are other arbitrary rules that may be held more or less pedantically, like the "no empty productions" rule, but they don't really affect the class of regular languages, just the compactness of the grammar you use for a particular language, as your example highlights - a single production with two alternatives vs. two productions, one with a single clause, and one with two alternatives, one of which is empty.

Operator precedence for IBM DB2

What are the operator precedence rules for the DB2 RDBMS engine?
I am looking for explicit rules which mention actual operators instead of precedence relations between groups of operators.
I found this document http://www-01.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/com.ibm.db2z10.doc.sqlref/src/tpc/db2z_precedenceofoperations.dita via googling, but I am looking for something that goes into more detail, e.g. precedence relations between AND, OR and NOT
If you're looking for search-condition operators, then see the Information Center section on Search conditions. Additional details are in the topic, but the basic rules are:
Search conditions within parentheses are evaluated first. If the order
of evaluation is not specified by parentheses, NOT is applied before
AND, and AND is applied before OR. The order in which operators at the
same precedence level are evaluated is undefined to allow for
optimization of search conditions.
From DB2 for z/OS 10.0.0>DB2 reference information>DB2 SQL>Language elements>Expressions>Precedence of operations
Expressions within parentheses are evaluated first. When the order of
evaluation is not specified by parentheses, prefix operators are
applied before multiplication and division, and multiplication,
division, and concatenation are applied before addition and
subtraction. Operators at the same precedence level are applied from
left to right.
I used a case in my order by and it seemed to work
SELECT * FROM TABLE WHERE KEY IN (KEY1 , KEY2) ORDER BY
CASE
WHEN KEY = KEY1 THEN 1
ELSE 2
END
I haven't check with more than 2 keys.
It's over here. Simple google could help you.

common meanings of punctuation characters

I'm writing my own syntax and want characters that do not have obvious common meanings in that syntax [1]. Is there a list of the common meanings of punctuation characters (e.g. '?' could be part of a ternary operator, or part of a regex) so I can try to pick those which may not have 'obvious' syntax (I can be the judge of that :-).
[1] It's actually an extended Fortran FORMAT, but the details are irrelevant here
Here is an exhaustive survey of syntax across languages.
I am loath to be so defeatist, but this does sound a bit like it doesn't exist ( a list of all the symbols / operators across languages ) a quick look around would give a good idea of what is commonplace.
Assuming that you will restrict yourself to ASCII, the short-list is more or less what you can see on your keyboard and I can can think of a few uses for most of them. So maybe avoiding conflicts is a bit ambitious. Of course it depends on who is to be the user of this syntax, if for example symbols that are relatively unused in Fotran would be suitable then that is more realistic.
This link: Fotran 95 Spec gives a list of Fortran operators, which might help if avoided.
I'm sorry if any of this is a statement of the obvious or missing the point, or just not very helpful :)
I would say [a-z][A-Z] All do not have an obvious syntax for instance. if you used Upper case T as an operator.
x T v
The downfall is people like to use letters for variables.
Other than that you might want to investigate multicharacter operators, the downfall of these however is that they quickly grow weary to type things like
scalar = vec4i *+ vec4j
if you perhaps had a Fused multiply add operator. Well that one isnt so bad, but I'm sure you can find more cumbersome ones.