Skip to main content

Character Tables and Tokenizer for Mathics3 and the Wolfram Language.

Project description

Workflows Pypi Installs Latest Version Supported Python Versions

Packaging status

Mathics3 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:

$ bash admin-tools/make-JSON-tables.sh

Utility for showing token parsing

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

Implementation

For notes on the implementation of the packages or details on the conversion scheme, please read Mathics3 scanner’s documentation or Scanning section of the Mathics3 User and Developers Guide.

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).

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

mathics3_scanner-10.0.0.tar.gz (217.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mathics3_scanner-10.0.0-py3-none-any.whl (180.6 kB view details)

Uploaded Python 3

File details

Details for the file mathics3_scanner-10.0.0.tar.gz.

File metadata

  • Download URL: mathics3_scanner-10.0.0.tar.gz
  • Upload date:
  • Size: 217.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for mathics3_scanner-10.0.0.tar.gz
Algorithm Hash digest
SHA256 e9626e79a70018747e1c7c66a0dd5515e3f7da29a52e840dc2d1540943429f56
MD5 34ed10097279d0c6c85d9498f5952bb4
BLAKE2b-256 a7aa229b6f93921a7d997beacbfc6a131e3416bfe3e4b67eaf302b38a2adfdb4

See more details on using hashes here.

File details

Details for the file mathics3_scanner-10.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mathics3_scanner-10.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f615c732cabe81878169174f9df9afe71a99a2aceaec0983eab55840bf521d4a
MD5 c9d53b6f8042572e73592527b8e8fd5d
BLAKE2b-256 3eb359a90b066203335e0893a1bbb6552bfd4d000bad9afec31cdac08bfde500

See more details on using hashes here.

Supported by

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