Skip to main content

Character Tables and Tokenizer for Mathics and the Wolfram Language.

Project description

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 and operators their properties

  • a tokenizer or scanner portion for the Wolfram Language.

With respect to the first item, there is a commented YAML that contains a full set of translation 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 precedence (if an operator)

  • Keyboard escape sequences for the symbol

Uses

The scanner and character tables are used inside Mathics. 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 Wolfram Language named character and convert them 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:

$ mathics-generate-json-table

Without options mathics-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 mathics-generate-json-table --help for a full list of fields.

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 Mathics! Create your own fork, make the desired changes, commit, and make a pull request.

License

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mathics_scanner-1.3.1.tar.gz (127.8 kB view details)

Uploaded Source

Built Distribution

Mathics_Scanner-1.3.1-py3-none-any.whl (115.9 kB view details)

Uploaded Python 3

File details

Details for the file mathics_scanner-1.3.1.tar.gz.

File metadata

  • Download URL: mathics_scanner-1.3.1.tar.gz
  • Upload date:
  • Size: 127.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for mathics_scanner-1.3.1.tar.gz
Algorithm Hash digest
SHA256 599a1e5bb84a802de424256b008ca93365bd73471d0aab5ae99f69028088df22
MD5 00319a274fe404960014192a753c4ec0
BLAKE2b-256 b494efe09f370643ca61ce720e7d2ca79d79a1ba27b43c9ee5dd25520c2e0a16

See more details on using hashes here.

File details

Details for the file Mathics_Scanner-1.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Mathics_Scanner-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e80b882c6e648ce2b56eb7244695df8969af967cdb281e8d2bb8212ac8ae8c3c
MD5 4740d6a1f10fb5d9ee94988429019c1f
BLAKE2b-256 13171c0fc60c508d88c91f873efbc8fe6d9fbc6746624e54e1cf3cb736cf395b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page