Skip to main content

Workflows Pypi Installs Latest Version Supported Python Versions

Packaging status

Mathics Character Tables and Scanner

This repository really contains two things:

  • extensive tables describing WL symbols, operators, and their properties

  • a tokenizer or scanner portion for the Wolfram Language.

Concerning the first item, there are two commented YAML files that contain a full set of translations between:

  • Wolfram Language named characters,

  • Unicode/ASCII equivalents and Unicode and WL code-points,

  • AMSLaTeX equivalent names,

  • Operator name (if symbol is an operator),

  • Operator arity (if an operator)

  • Operator precedence (if an operator)

  • Operator associativity (if an operator)

  • Keyboard escape sequences for the symbol

Uses

The scanner and character tables are used inside Mathics3. However information can also be used by other programs for tokenizing and formatting Wolfram Language code.

For example, tables are used in mathics-pygments, a Pygments-based lexer and highlighter for Mathematica/Wolfram Language source code.

This library may be useful if you need to work with the Wolfram Language named character and convert it to various formats.

Usage

  • For tokenizing and scanning Wolfram Language code, use the mathics_scanner.tokenizer.Tokenizer class.

  • To convert between Wolfram Language named characters and Unicode/ASCII, use the mathics_scanner.characters.replace_wl_with_plain_text and mathics_scanner.characters.replace_unicode_with_wl functions.

  • To convert between qualified names of named characters (such FormalA for \[FormalA]) and Wolfram’s internal representation use the m̀athics_scanner.characters.named_characters dictionary.

To regenerate JSON-format tables, run:

$ mathics3-generate-json-table
$ mathics3-generate-operator-json-table

Without options, mathics3-generate-json-table produces the maximum set of correspondences.

In most applications, though, you may need just a few of these. The --field option can be used to narrow the list of entries to output in JSON. Run mathics3-generate-json-table --help for a full list of fields.

Utility for showing token parsing

There is a command-line utility, mathics3-tokens, for showing how an input stream is tokenized. The --CodeTokenize or -C option will try to show the token as it would appear using CodeTokenize. type mathics3-tokens --help information on command-line options.

Implementation

For notes on the implementation of the packages or details on the conversion scheme please read Implementation.

Contributing

Please feel encouraged to contribute to this package or Mathics3! Create your own fork, make the desired changes, commit, and make a pull request.

License

Mathics3 is released under the GNU General Public License Version 3 (GPL3).

Release files for Mathics-Scanner 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Mathics-Scanner 2.0.0
File Size Uploaded
mathics_scanner-2.0.0.tar.gz 199.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Mathics-Scanner 2.0.0
File Interpreter ABI Platform
mathics_scanner-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 368.1 kB

Release files / mathics_scanner-2.0.0.tar.gz

Download URL mathics_scanner-2.0.0.tar.gz
Size 199.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0424ae0918313640af52a7bbadc91824ca1869eb1ad0e0dd87c784c141326d9a
BLAKE2b-256 checksum
How to use checksums
b4b2ebc6c89c6e919d9e087ef688305e07a4a0f68ad611741cb21c02fbf261cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / mathics_scanner-2.0.0-py3-none-any.whl

Download URL mathics_scanner-2.0.0-py3-none-any.whl
Size 168.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
033d228f42f9071692838daa6194121464fcdd12ef4fa78de134f1a00a5d5fb2
BLAKE2b-256 checksum
How to use checksums
d62c9ad05505118fcc4d4aefa4d643d1423192567c34d2a3a004be7575ccf329
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.4.1

2 release files

1.4.0

1.3.1

2 release files

1.3.0

9 release files

1.2.4

7 release files

1.2.3

7 release files

1.2.2

7 release files

1.2.1

7 release files

1.2.0

7 release files

1.1.2

7 release files

1.1.1

7 release files

1.1.0

7 release files

1.0.0

7 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page