Skip to content

Commit

Permalink
Go over operator characters... (#71)
Browse files Browse the repository at this point in the history
* Go over operator characters...

and add more information in operators YAML

* Go over Integrals...

their arity, and operatorness.

Also fix spelling mistakes caught by mmatera
  • Loading branch information
rocky committed Sep 13, 2024
1 parent 5f8f525 commit d8434aa
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 76 deletions.
10 changes: 5 additions & 5 deletions mathics_scanner/data/OperatorTable.csv
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ Cup,Cup,440,340,340,43,43,460,460,{},"{""⌣""}",{},"{{""expr1"", ""⌣"", ""exp
CircleMinus,CircleMinus,430,330,330,44,44,450,450,{},"{""⊖""}",{},"{{""expr1"", ""⊖"", ""expr2""}}","{""CircleMinus"", ""["", ""expr1"", "","", ""expr2"", ""]""}","CircleMinus[expr1, expr2]",Binary,Infix,Left,False,
CirclePlus,CirclePlus,430,330,330,44,44,450,450,{},"{""⊕""}",{},"{{""expr1"", ""⊕"", ""expr2""}}","{""CirclePlus"", ""["", ""expr1"", "","", ""expr2"", ""]""}","CirclePlus[expr1, expr2]",Binary,Infix,None,False,
Sum,Sum,420,320,325,45,45,440,445,"{""∑""}",{},{},"{{""∑"", ""expr""}}","{""Sum"", ""["", ""expr"", ""]""}",Sum[expr],Unary,Prefix,Right,True,Usage and Parse may not be correct.
Integrate,Integral,420,325,325,23,45,455,445,"{""∫""}",{},"{""""}","{{""∫"", ""expr1"", """", ""expr2""}}","{""Integrate"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Binary,Prefix,Right,True,
ClockwiseContourIntegral,ClockwiseContourIntegral,420,670,325,,45,455,445,"{""∲""}",{},"{""""}","{{""∲"", ""expr1"", """", ""expr2""}}","{""ClockwiseContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Unary,Prefix,Right,True,Usage and Parse may not be correct.
ContourIntegral,ContourIntegral,420,670,325,,45,455,445,"{""∮""}",{},"{""""}","{{""∮"", ""expr1"", """", ""expr2""}}","{""ContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Unary,Prefix,Right,True,Usage and Parse may not be correct.
CounterClockwiseContourIntegral,CounterClockwiseContourIntegral,420,670,325,,45,455,445,"{""∳""}",{},"{""""}","{{""∳"", ""expr1"", """", ""expr2""}}","{""CounterClockwiseContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Unary,Prefix,Right,True,Usage and Parse may not be correct.
DoubleContourIntegral,DoubleContourIntegral,420,670,325,,45,455,445,"{""∯""}",{},"{""""}","{{""∯"", ""expr1"", """", ""expr2""}}","{""DoubleContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Unary,Prefix,Right,True,Usage and Parse may not be correct.
Integrate,Integral,420,325,325,23,45,455,445,"{""∫""}",{},"{""""}","{{""∫"", ""expr1"", """", ""expr2""}}","{""Integrate"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Binary,Compound,Right,True,
ClockwiseContourIntegral,ClockwiseContourIntegral,420,670,325,,45,455,445,"{""∲""}",{},"{""""}","{{""∲"", ""expr1"", """", ""expr2""}}","{""ClockwiseContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Binary,Compound,Right,True,Usage and Parse may not be correct.
ContourIntegral,ContourIntegral,420,670,325,,45,455,445,"{""∮""}",{},"{""""}","{{""∮"", ""expr1"", """", ""expr2""}}","{""ContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Binary,Compound,Right,True,Usage and Parse may not be correct.
CounterClockwiseContourIntegral,CounterClockwiseContourIntegral,420,670,325,,45,455,445,"{""∳""}",{},"{""""}","{{""∳"", ""expr1"", """", ""expr2""}}","{""CounterClockwiseContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Binary,Compound,Right,True,Usage and Parse may not be correct.
DoubleContourIntegral,DoubleContourIntegral,420,670,325,,45,455,445,"{""∯""}",{},"{""""}","{{""∯"", ""expr1"", """", ""expr2""}}","{""DoubleContourIntegral"", ""["", ""expr1"", "","", ""expr2"", ""]""}","Integrate[expr1, expr2]",Binary,Compound,Right,True,Usage and Parse may not be correct.
ExpectationE,ExpectationE,420,325,325,,45,455,445,"{""""}",{},{},"{{"""", ""expr""}}","{""ExpectationE"", ""["", ""expr"", ""]""}",,Unary,Prefix,Right,True,Usage and Parse may not be correct.
ProbabilityPr,ProbabilityPr,420,325,325,,45,455,445,"{""""}",{},{},"{{"""", ""expr""}}","{""ProbabilityPr"", ""["", ""expr"", ""]""}",,Unary,Prefix,Right,True,Usage and Parse may not be correct.
Limit,Limit,410,320,320,,45.5,440,440,"{""""}",{},{},"{{"""", ""expr""}}","{""Limit"", ""["", ""expr"", ""]""}",,Unary,Prefix,Right,True,Usage and Parse may not be correct.
Expand Down
106 changes: 75 additions & 31 deletions mathics_scanner/data/named-characters.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Information about Wolfram Language named characters, indexed by
# their fully qualified names.
# Information about Wolfram Language Named Characters.
# See https://reference.wolfram.com/language/tutorial/InputAndOutputInNotebooks.html#4718

# Heuristics to consider in adding a Named Character.
# ===================================================

# 1. Unicode symbols used by Mathemathica that are not in the Unicode Private Use Area are the same in Mathics3
# 2. Unicode symbols that correspond semantically with existing mathematical symbols are included. Example: − (U+2212, "Minus Sign")
# is an alias for ASCII - even though Mathematica does not consider it so.
# 3. Unicode symbols outside of the Mathematical Operators Block (and the ASCII block) should be excluded unless one of the previous
# heuristics includes it. Example: ✕ (U+2715, "Multiplication X") can be used for Times but is in the Dingbats Block and is thus excluded.
# 4. All typographical variants of "plain"/"regular" symbols are be excluded unless included by a previous heuristic.
# For example, all Full Width variants, bold variants, italic variants, and so forth are excluded.
# 5. Unicode symbols cannot be overloaded, i.e. should not be used for more than one underlying function.
# For example, ≫ (U+226B, "Much Greater-Than") is already used for GreaterGreater and therefore should not be an alias for >> for Put.
# Likewise, ≪ (U+226A, "Much Less-Than") for Get, ∷ (U+2237, "Proportion") for MessageName, etc.

#
# Field definitions
# =================
Expand Down Expand Up @@ -32,6 +47,9 @@
# prespective, an operator name like "Association"
# might have *two* (bracketing) symbols associated
# here: "LeftAssociation" and "RightAssociation".
# More operator information can be found in
# file "operators.yml".
#
#
# unicode-equivalent: A unicode equivalent for the named-character, if it
# exists. If it is the same as "ascii", please omit.
Expand All @@ -53,6 +71,7 @@
# http://milde.users.sourceforge.net/LUCR/Math/unimathsymbols.pdf
# https://reference.wolfram.com/language/ref/character/....html
# https://github.com/rsmenon/pygments-mathematica
# https://reference.wolfram.com/language/tutorial/OperatorInputForms.html

AAcute:
amslatex: "\\'{a}"
Expand Down Expand Up @@ -143,12 +162,12 @@ Apply:

# @@@ replaces heads at level 1 of expr by f.
# We add "3Ats" at the end so keys are unique, but
# the WL operator is still "Apply".
# the WL operator is still "MapApply".
Apply3Ats:
ascii: "@@@"
has-unicode-inverse: false
is-letter-like: false
operator-name: Apply
operator-name: MapApply

ApplyTo:
ascii: "//="
Expand Down Expand Up @@ -1660,12 +1679,6 @@ Decrement:

# See also PatternTest and RawQuestion

Definition:
ascii: "?"
has-unicode-inverse: false
is-letter-like: false
operator-name: Definition

# \[Degree] is letter-like, not an operator, which is
# mutually exclusive.

Expand Down Expand Up @@ -2677,7 +2690,6 @@ DownLeftVectorBar:
DownPointer:
has-unicode-inverse: false
is-letter-like: false
operator-name: DownPointer
unicode-equivalent: "\u25BE"
unicode-equivalent-name: BLACK DOWN-POINTING SMALL TRIANGLE
wl-unicode: "\u25BE"
Expand Down Expand Up @@ -4966,12 +4978,6 @@ Implies:
unicode-equivalent-name: RIGHTWARDS DOUBLE ARROW
wl-unicode: "\uF523"

Increment:
ascii: "++"
has-unicode-inverse: false
is-letter-like: false
operator-name: Increment

IndentingNewLine:
esc-alias: nl
has-unicode-inverse: false
Expand Down Expand Up @@ -5003,12 +5009,12 @@ Information:
is-letter-like: false
operator-name: Information

# https://reference.wolfram.com/language/ref/character/Integral.html
Integral:
amslatex: "\\int"
esc-alias: int
has-unicode-inverse: false
is-letter-like: false
# TODO: This should be a prefix operator
operator-name: Integral
unicode-equivalent: "\u222B"
unicode-equivalent-name: INTEGRAL
Expand Down Expand Up @@ -5188,6 +5194,7 @@ LeftAssociation:
esc-alias: <|
has-unicode-inverse: false
is-letter-like: false
operator-name: LeftAssociation
wl-unicode: "\uF113"

LeftBracketingBar:
Expand All @@ -5208,10 +5215,12 @@ LeftCeiling:
wl-unicode: "\u2308"
wl-unicode-name: LEFT CEILING

# Left part of "Part[] operator
LeftDoubleBracket:
esc-alias: '[['
has-unicode-inverse: false
is-letter-like: false
operator-name: LeftPart
unicode-equivalent: "\u301A"
unicode-equivalent-name: LEFT WHITE SQUARE BRACKET
wl-unicode: "\u301A"
Expand All @@ -5221,6 +5230,7 @@ LeftDoubleBracketingBar:
esc-alias: l||
has-unicode-inverse: false
is-letter-like: false
operator-name: LeftDoubleBracketingBar
unicode-equivalent: "\u2016"
unicode-equivalent-name: DOUBLE VERTICAL LINE
wl-unicode: "\uF605"
Expand Down Expand Up @@ -5271,6 +5281,12 @@ LeftGuillemet:
wl-unicode: "\xAB"
wl-unicode-name: LEFT-POINTING DOUBLE ANGLE QUOTATION MARK

LeftList:
ascii: "{{"
has-unicode-inverse: false
is-letter-like: false
operator-name: LeftList

LeftModified:
esc-alias: '['
has-unicode-inverse: false
Expand All @@ -5280,7 +5296,6 @@ LeftModified:
LeftPointer:
has-unicode-inverse: false
is-letter-like: false
operator-name: LeftPointer
unicode-equivalent: "\u25C2"
unicode-equivalent-name: BLACK LEFT-POINTING SMALL TRIANGLE
wl-unicode: "\u25C2"
Expand Down Expand Up @@ -5530,7 +5545,6 @@ LongDash:
esc-alias: --
has-unicode-inverse: false
is-letter-like: false
operator-name: LongDash
unicode-equivalent: "\u2014"
unicode-equivalent-name: EM DASH
wl-unicode: "\u2014"
Expand Down Expand Up @@ -5612,6 +5626,12 @@ MapApply:
is-letter-like: false
operator-name: MapApply

MaxLimit:
esc-alias: Mlim
has-unicode-inverse: false
is-letter-like: false
wl-unicode: "\uF439"

Mars:
has-unicode-inverse: false
is-letter-like: false
Expand Down Expand Up @@ -5649,11 +5669,11 @@ Mercury:
wl-unicode: "\u263F"
wl-unicode-name: MERCURY

Message:
MessageName:
ascii: "::"
has-unicode-inverse: false
is-letter-like: false
operator-name: Message
operator-name: MessageName

Mho:
esc-alias: mho
Expand Down Expand Up @@ -5681,6 +5701,14 @@ Minus:
operator-name: Minus
unicode-equivalent: "\u2212"

MinLimit:
amslatex: "\\lim_"
esc-alias: mlim
has-unicode-inverse: false
is-letter-like: false
unicode-equivalent: "lim"
wl-unicode: "\uF43A"

MinusPlus:
amslatex: "\\mp"
esc-alias: -+
Expand Down Expand Up @@ -5890,7 +5918,7 @@ NotEqual:
esc-alias: '!='
has-unicode-inverse: false
is-letter-like: false
operator-name: NotEqual
operator-name: Unequal
unicode-equivalent: "\u2260"
unicode-equivalent-name: NOT EQUAL TO
wl-unicode: "\u2260"
Expand Down Expand Up @@ -6201,6 +6229,7 @@ NotSucceeds:

NotSucceedsEqual:
has-unicode-inverse: false
operator-name: NotSucceedsEqual
is-letter-like: false
wl-unicode: "\uF42D"

Expand Down Expand Up @@ -6429,7 +6458,6 @@ Option:
ascii: ":"
has-unicode-inverse: false
is-letter-like: false
operator-name: Option

OptionKey:
esc-alias: opt
Expand All @@ -6441,6 +6469,7 @@ Or:
esc-alias: '||'
has-unicode-inverse: false
is-letter-like: false
operator-name: Or
unicode-equivalent: "\u2228"
unicode-equivalent-name: LOGICAL OR
wl-unicode: "\u2228"
Expand Down Expand Up @@ -6493,7 +6522,7 @@ PartialD:
wl-unicode: "\u2202"
wl-unicode-name: PARTIAL DIFFERENTIAL

# See also Definition and RawQuestion
# See also RawQuestion
PatternTest:
ascii: "?"
has-unicode-inverse: false
Expand Down Expand Up @@ -6599,6 +6628,12 @@ Power:
wl-unicode: "^"
wl-unicode-name: CIRCUMFLEX ACCENT

PreIncrement:
ascii: "++"
has-unicode-inverse: false
is-letter-like: false
operator-name: PreIncrement

Precedes:
has-unicode-inverse: false
is-letter-like: false
Expand Down Expand Up @@ -6777,19 +6812,20 @@ RawEscape:
is-letter-like: false
wl-unicode: "\e"

# Note: RawGreater WL's name for Mathics Greater or ASCII ">"
# Note: the operator name and key name differ.
RawGreater:
ascii: ">"
has-unicode-inverse: true
is-letter-like: false
operator-name: RawGreater
operator-name: Greater
unicode-equivalent-name: GREATER-THAN SIGN
wl-unicode: "\u003e"
wl-unicode-name: GREATER-THAN SIGN

RawLeftBrace:
ascii: '{'
has-unicode-inverse: false
operator-name: LeftList
is-letter-like: false

RawLeftBracket:
Expand All @@ -6812,7 +6848,7 @@ RawPercent:
has-unicode-inverse: false
is-letter-like: false

# See also Definition and PatternTest
# See also PatternTest
RawQuestion:
ascii: "?"
has-unicode-inverse: false
Expand Down Expand Up @@ -7079,6 +7115,7 @@ RightAssociation:
esc-alias: '|>'
has-unicode-inverse: false
is-letter-like: false
operator-name: RightAssociation
wl-unicode: "\uF114"

RightBracketingBar:
Expand All @@ -7105,10 +7142,12 @@ RightComposition:
is-letter-like: false
operator-name: RightComposition

# Right part of "Part[] operator
RightDoubleBracket:
esc-alias: ']]'
has-unicode-inverse: false
is-letter-like: false
operator-name: RightPart
unicode-equivalent: "\u301B"
unicode-equivalent-name: RIGHT WHITE SQUARE BRACKET
wl-unicode: "\u301B"
Expand Down Expand Up @@ -7169,6 +7208,12 @@ RightGuillemet:
wl-unicode: "\xBB"
wl-unicode-name: RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK

RightList:
ascii: "}}"
has-unicode-inverse: false
is-letter-like: false
operator-name: RightList

RightModified:
esc-alias: ']'
has-unicode-inverse: false
Expand All @@ -7178,7 +7223,6 @@ RightModified:
RightPointer:
has-unicode-inverse: false
is-letter-like: false
operator-name: RightPointer
unicode-equivalent: "\u25B8"
unicode-equivalent-name: BLACK RIGHT-POINTING SMALL TRIANGLE
wl-unicode: "\u25B8"
Expand Down Expand Up @@ -8583,11 +8627,11 @@ UndirectedEdge:
unicode-equivalent-name: LEFT RIGHT ARROW
wl-unicode: "\uF3D4"

UnSameQ:
UnsameQ:
ascii: "=!="
has-unicode-inverse: false
is-letter-like: false
operator-name: UnSameQ
operator-name: UnsameQ

Union:
esc-alias: un
Expand Down
15 changes: 15 additions & 0 deletions mathics_scanner/data/operators-additional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
# Note: we keep the misspelling of "meaningfull"
# and the uncoverted types like None and True

ApplyTo:
actual-precedence: 75
Precedence: 75 # CSV has 604 which is wrong
Precedence-corrected: 75
Precedence-Function: 75
WolframLanguageData: 76
WolframLanguageData-corrected: 75
UnicodeCharacters.tr:
UnicodeCharacters-corrected.tr: 75
arity: Binary
affix: Infix
associativity: left
meaningfull: "true"
# comments:

Derivative:
actual-precedence: 770
Precedence: 670 # CSV has 604 which is wrong
Expand Down
Loading

0 comments on commit d8434aa

Please sign in to comment.