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

Operator info from Operators.YML file (in MathicsScanner) #1180

Closed
wants to merge 22 commits into from

Conversation

rocky
Copy link
Member

@rocky rocky commented Nov 23, 2024

This is an extension and follow-on to #1174 .

More of the data encoded in mathics.core.parsers.operators now comes from JSON. And all of the operators without builtin-meanings are included.

There will be some more work to fix up the MANIFESTs (@mmatera are you up for this? And some additional changes would be nice in mathicsscanner to include all of the operators without built-in meanings. Right now, these are not pulled from JSON and are incomplete.

@rocky rocky requested a review from mmatera November 23, 2024 22:40
@rocky rocky force-pushed the operator-info-from-JSON branch from 161f3b8 to 8b3f7b1 Compare November 23, 2024 22:43
@rocky rocky marked this pull request as draft November 23, 2024 23:02
@rocky
Copy link
Member Author

rocky commented Nov 23, 2024

Since we test all new Builtin functions without pre-defined meaning including the operator form of that, these have to exist in the scanner. Some of these unicode operator symbols are currently missing.

I will be making another round in MathicsScanner to pick up all of these such operators from the YML soon.

@mmatera
Copy link
Contributor

mmatera commented Nov 23, 2024

What about using a blacklist in mathics-corr, to avoid loading the incomplete symbols?

@rocky
Copy link
Member Author

rocky commented Nov 23, 2024

What about using a blacklist in mathics-corr, to avoid loading the incomplete symbols?

I'd rather do a relatively small amount of work to finish that aspect than add some code that will be ripped out soon. There will be many other things that could be improved that can wait and be done.

@mmatera
Copy link
Contributor

mmatera commented Nov 24, 2024

Ok,when I get some time I'll do it.

mmatera and others added 6 commits November 24, 2024 09:48
and put initialization code in `mathics.builtin.no_meaning` inside an
initialization function.
We have a dependency problem in mathics-scanner where
code is performed in tokeniser loading. And the
script that creates a needed JSON file imports
mathics_scanner which imports the tokenser which
needs that JSON file to pre-exist.

The workaround here is to not import is_symbol_name from
mathics_scanner but from mathics_scanner.tokeniser

By doing this when the JSON-creating program imports mathics_scanner
it does not import the module that requires the JSON file.

An attempt was made to delay JSON-reading, but something is still
whacky, so that doesn't work yet. Punt on this aspect for later.
Makefile Outdated
@@ -142,10 +142,9 @@ latexdoc texdoc doc:
(cd mathics/doc/latex && $(MAKE) doc)

#: Build JSON ASCII to unicode opcode table and operator table
mathics/data/op-tables.json mathics/data/operators.json:
mathics/data/operator-tables.json mathics/data/op-tables.json mathics/data/operators.json:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operators.json is not in mathics-core/mathics/data but in mathics_scanner/data/

Copy link
Contributor

@mmatera mmatera Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I should have put a line in mathics_scanner.generate.build_operator_tables that prints where operators.json is stored...)

@@ -134,8 +134,10 @@ System`Automatic
System`Axes
System`Axis
System`Background
System`Backslash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rocky, the changes in the SYMBOLS_MANIFEST.txt are already done...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I ran must have changed this. I definitely have not been changing this by hand.

At any rate, just fix whatever problem you encounter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fixed automatically once you run the test locally, and the test passes. It does not seem to fail here. What is failing is the localization of the operator.json file, that is not generated in the place where mathics_scanner.tokenizer looks for it.

@rocky
Copy link
Member Author

rocky commented Nov 29, 2024

I had considered this a dead branch that should be closed and deleted. At some point this branch was previously merged. Locally I forgot to delete it and committed on top things that I think were also committed to a different branch.

@mmatera
Copy link
Contributor

mmatera commented Nov 29, 2024

Ok, then we need to adjust the mathics tests in mathics scanner

@rocky rocky closed this Nov 30, 2024
@rocky rocky deleted the operator-info-from-JSON branch November 30, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants