Parser: add missing standard infix operators (** ^ >> << xor div /\ \/ :) #29

Closed
opened 2026-06-02 20:08:44 +00:00 by navicore · 1 comment
Owner

Summary

Several standard infix operators are absent from the parser. Tested via
in-file clauses (which error cleanly on an unknown operator):

Operator Std type/prec Role Status
** xfx 200 float power parse error (unexpected \*``)
^ xfy 200 int power parse error (Unexpected character '^')
>> yfx 400 shift right parse error (expected \.`, got `>``)
<< yfx 400 shift left parse error
xor yfx 500 bitwise xor parse error (got atom \xor``)
div yfx 400 floor division parse error (got atom \div``)
/\ yfx 500 bitwise and parse error (Unexpected '\')
\/ yfx 500 bitwise or parse error
: xfy 200 module/qualifier parse error (Unexpected ':')

Supported today (baseline): mod, rem, + - * / //, the 700-level
comparison/is/=.. family, and , ; ->.

Repro

t :- X is 2 ** 3, X =:= 8.      % Parse error: unexpected `*`
t :- X is 8 >> 1, X =:= 4.      % Parse error: expected `.`, got `>`
t :- X is 6 /\ 3, X =:= 2.      % Parse error: Unexpected '\'

Notes

  • The arithmetic ones (** ^ >> << xor div /\ \/) need both a parser
    operator entry and an evaluable-function in is/2.
  • : is non-arithmetic (module qualifier / general infix) — parser-level only.
  • Bitwise \ (and /\, \/) require tokenizer work — \ is not a standalone
    token today (see prefix-gap issue #28).

Context

Found while building the loglings operator lessons. Companion to the prefix
gap (#28). Together these complete the standard operator table, after which the
"full prefix + infix" documentation can be written accurately.


Reported against prlg 0.4.1.

## Summary Several standard infix operators are absent from the parser. Tested via in-file clauses (which error cleanly on an unknown operator): | Operator | Std type/prec | Role | Status | |---|---|---|---| | `**` | xfx 200 | float power | parse error (`unexpected \`*\``) | | `^` | xfy 200 | int power | parse error (`Unexpected character '^'`) | | `>>` | yfx 400 | shift right | parse error (`expected \`.\`, got \`>\``) | | `<<` | yfx 400 | shift left | parse error | | `xor`| yfx 500 | bitwise xor | parse error (`got atom \`xor\``) | | `div`| yfx 400 | floor division | parse error (`got atom \`div\``) | | `/\` | yfx 500 | bitwise and | parse error (`Unexpected '\'`) | | `\/` | yfx 500 | bitwise or | parse error | | `:` | xfy 200 | module/qualifier | parse error (`Unexpected ':'`) | Supported today (baseline): `mod`, `rem`, `+ - * / //`, the 700-level comparison/`is`/`=..` family, and `, ; ->`. ## Repro ```prolog t :- X is 2 ** 3, X =:= 8. % Parse error: unexpected `*` t :- X is 8 >> 1, X =:= 4. % Parse error: expected `.`, got `>` t :- X is 6 /\ 3, X =:= 2. % Parse error: Unexpected '\' ``` ## Notes - The arithmetic ones (`** ^ >> << xor div /\ \/`) need **both** a parser operator entry **and** an evaluable-function in `is/2`. - `:` is non-arithmetic (module qualifier / general infix) — parser-level only. - Bitwise `\` (and `/\`, `\/`) require tokenizer work — `\` is not a standalone token today (see prefix-gap issue #28). ## Context Found while building the `loglings` operator lessons. Companion to the prefix gap (#28). Together these complete the standard operator table, after which the "full prefix + infix" documentation can be written accurately. --- Reported against `prlg` 0.4.1.
Author
Owner

#33

https://git.navicore.tech/navicore/patch-prolog/pulls/33
navicore referenced this issue from a commit 2026-06-02 22:57:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-prolog#29
No description provided.