Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "name" field from YAML... #70

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mathics_scanner/data/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ Input data for conversion programs is in YAML:
``named-characters.yml`` and ``operators.yml`` Processed data is in
JSON since that is the format which affords the fasted loading into
Python programs (via ujson).

Json output is not formatted in any way to facilitate loaded. To see
json output formated use a JSON formatter like ``jq``:

cat characters.json | jq
5 changes: 0 additions & 5 deletions mathics_scanner/data/operators-additional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# and the uncoverted types like None and True

Derivative:
name: Derivative
actual-precedence: 770
Precedence: 670 # CSV has 604 which is wrong
Precedence-corrected: 670
Expand All @@ -26,7 +25,6 @@ Derivative:
# comments:

Information:
name: Information
actual-precedence: 670
Precedence: 670
Precedence-corrected: 670
Expand All @@ -48,7 +46,6 @@ Information:

# This operator is a little sketchy
InterpretedBox:
name: InterpretedBox
actual-precedence: 670
Precedence: 670
Precedence-corrected: 670
Expand All @@ -69,7 +66,6 @@ InterpretedBox:
# comments:

Postfix:
name: Postfix
actual-precedence: 640
Precedence: 640
Precedence-corrected: 640
Expand All @@ -90,7 +86,6 @@ Postfix:
# comments:

Prefix:
name: Prefix
actual-precedence: 640
Precedence: 640
Precedence-corrected: 640
Expand Down
46 changes: 27 additions & 19 deletions mathics_scanner/data/operators-intro.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Information about Wolfram Language named operators.

# This information comes from Robert L. Jacobson's Table of Wolfram
# Language Operators found at:
# https://github.com/WLTools/LanguageSpec/blob/master/docs/Specification/Syntax/Operator%20Table.csv

# See
# https://www.robertjacobson.dev/posts/2018-09-04-defining-the-wolfram-language-part-2-operator-properties/
# for a description of some of the fields used here.
# This information comes largely from Robert L. Jacobson's Table of
# Wolfram Language Operators found at:
# https://github.com/WLTools/LanguageSpec/blob/master/docs/Specification/Syntax/Operator%20Table.csv

# We have copy of this in the Mathics-Scanner repository.
# The CSV file has been converted to YAML using mathics_scanner/generate/operator_csv_to_yaml.py
#
# Many fields below mention precedence. This is an integer used in
# specifying the order operations occur when one operator is
# For a description of many of the fields below, see
# https://www.robertjacobson.dev/posts/2018-09-03-generalizing-pemdas-what-is-an-operator/
# and:
# https://www.robertjacobson.dev/posts/2018-09-04-defining-the-wolfram-language-part-2-operator-properties/

# However, I will summmarize some of the field descriptions.

# precedence
# ----------

# Many fields below mention precedence, and the WMA builtin-function
# Precedence[]. When given an operator, this function gives an integer
# used in specifying the order operations occur when one operator is
# juxtaposed against another operator. A higher value means that the
# operator binds before an operator with a lower value.

Expand All @@ -23,24 +30,25 @@
# | and ->. So the precedence of |-> has to be higher than |.
#

# arity (https://en.wikipedia.org/wiki/Arity)
# -----
#
# A fancy word for how many operands (arguments) the operator takes;
# it is some sort of positive integer. Acceptable values found in our table
# are:
# - NullAry (0 arguments),
# - Unary (1 argument),
# - Binary (2 arguments)
# - Ternary (3 arguments)
# - n-ary (n arguments)

# Field definitions
# =================

# name: this is the WL name. When it exits it will also be the name of the key
# actual-precedence: a precedence value that programs can use.
# Precedence: the value returned for this operator using the WL function Precedence[]
# Precedence-corrected: the value used in Mathics3.
# WolframLangageData: a value returned using WolframLangageData[???]
# usage: when it exists, an example of the use of this operator
# parse: when "usage" exists, a parse of the example
# parse: when "usage" exists, the FullForm translation of the example
# arity: the number of arguments the operator takes. One of:
# - Binary (2 arguments)
# - NullAry (0 arguments),
# - Ternary (3 arguments)
# - Unary (1 argument),
# - n-ary (n arguments)

# associativity: when two or more of the same operator is used, which group to
# evaluate first. One of:
Expand Down
Loading
Loading