{"_id":"@andstor/latex-math-parser","_rev":"2-b14ca982d0dbb08a567005a114630aaf","name":"@andstor/latex-math-parser","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@andstor/latex-math-parser","version":"1.0.0","keywords":["latex","parser","peggy"],"author":{"url":"https://github.com/andstor","name":"André Storhaug","email":"andr3.storhaug@gmail.com"},"license":"MIT","_id":"@andstor/latex-math-parser@1.0.0","maintainers":[{"name":"andstor","email":"andr3.storhaug@gmail.com"}],"homepage":"https://github.com/andstor/latex-math-parser","bugs":{"url":"https://github.com/andstor/latex-math-parser/issues"},"dist":{"shasum":"b322b4b4a51bc1f3091eeefcaa4e767eda46631f","tarball":"https://registry.npmjs.org/@andstor/latex-math-parser/-/latex-math-parser-1.0.0.tgz","fileCount":10,"integrity":"sha512-Ka1Js401fjCzZ9RF11BKUvdons+HmuqUL2jiWzuWvAhk0q2DE/vOEjJQCbgthtmxbvrdl6OWS86zrvEQ7izHIg==","signatures":[{"sig":"MEYCIQCJRrZpAc0JUIS9rbW7i7PFBLJj161M/dfoUuHqzknp0wIhAIb590uNffdlizPTOGmB/7OvWRB5kvoc0P/PBthXJ9vM","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":730266},"main":"index.js","type":"module","types":"dist/src","watch":{"build":{"patterns":["src/grammars/latex.pegjs","src/generator.ts"],"extensions":["pegjs","ts"]}},"gitHead":"945c6359e07c54964661397f4a98cc27b2e82337","scripts":{"test":"mocha","build":"node ./generate.js && tsc ","watch":"npm-watch"},"_npmUser":{"name":"andstor","email":"andr3.storhaug@gmail.com"},"repository":{"url":"git+https://github.com/andstor/latex-math-parser.git","type":"git"},"_npmVersion":"10.8.2","description":"Parser for parsing LaTeX math expressions","directories":{},"sideEffects":false,"_nodeVersion":"20.19.3","dependencies":{"peggy":"^1.2.0","ts-pegjs":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.4","mocha":"^9.0.3","ts-node":"^10.1.0","npm-watch":"^0.11.0","typescript":"^4.3.5","@types/chai":"^4.2.21","@types/node":"^16.4.12","@types/mocha":"^9.0.0","pegjs-backtrace":"^0.2.1","source-map-support":"^0.5.19"},"_npmOperationalInternal":{"tmp":"tmp/latex-math-parser_1.0.0_1752265560676_0.3332159061778137","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@andstor/latex-math-parser","version":"1.0.1","description":"Parser for parsing LaTeX math expressions","main":"index.js","type":"module","repository":{"type":"git","url":"git+https://github.com/andstor/latex-math-parser.git"},"bugs":{"url":"https://github.com/andstor/latex-math-parser/issues"},"homepage":"https://github.com/andstor/latex-math-parser","scripts":{"test":"mocha","build":"node ./generate.js && tsc ","watch":"npm-watch"},"keywords":["latex","parser","peggy"],"author":{"name":"André Storhaug","email":"andr3.storhaug@gmail.com","url":"https://github.com/andstor"},"license":"MIT","types":"dist/src","sideEffects":false,"dependencies":{"peggy":"^1.2.0","ts-pegjs":"^1.1.1"},"devDependencies":{"@types/chai":"^4.2.21","@types/mocha":"^9.0.0","@types/node":"^16.4.12","chai":"^4.3.4","mocha":"^9.0.3","npm-watch":"^0.11.0","pegjs-backtrace":"^0.2.1","source-map-support":"^0.5.19","ts-node":"^10.1.0","typescript":"^4.3.5"},"watch":{"build":{"patterns":["src/grammars/latex.pegjs","src/generator.ts"],"extensions":["pegjs","ts"]}},"_id":"@andstor/latex-math-parser@1.0.1","gitHead":"a491c120a35e360e3de8b30226e2aa9c39fa169c","_nodeVersion":"20.19.3","_npmVersion":"10.8.2","dist":{"integrity":"sha512-BhbAfd77VvxwYV8mMNMBHAWejPAehfvSHVra9ZzdASTwvdjxim3YsAquvpi7sKJh6O/ZB3BTeZUJzJHTAGcJGA==","shasum":"5e9044c81cb075070059fc43e1cb70b95f117be4","tarball":"https://registry.npmjs.org/@andstor/latex-math-parser/-/latex-math-parser-1.0.1.tgz","fileCount":10,"unpackedSize":730282,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDI0Q/PolRmSYAqBfhnN+GuywCC81YlH9BM30zPhTe8JwIhAKreJ9mYumTjQR/I+11vB/4wIMTmzZk5OizeXoRxl3MY"}]},"_npmUser":{"name":"andstor","email":"andr3.storhaug@gmail.com"},"directories":{},"maintainers":[{"name":"andstor","email":"andr3.storhaug@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/latex-math-parser_1.0.1_1752274282804_0.7151198298142329"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-11T20:26:00.569Z","modified":"2025-07-11T22:51:23.188Z","1.0.0":"2025-07-11T20:26:00.865Z","1.0.1":"2025-07-11T22:51:23.008Z"},"bugs":{"url":"https://github.com/andstor/latex-math-parser/issues"},"author":{"name":"André Storhaug","email":"andr3.storhaug@gmail.com","url":"https://github.com/andstor"},"license":"MIT","homepage":"https://github.com/andstor/latex-math-parser","keywords":["latex","parser","peggy"],"repository":{"type":"git","url":"git+https://github.com/andstor/latex-math-parser.git"},"description":"Parser for parsing LaTeX math expressions","maintainers":[{"name":"andstor","email":"andr3.storhaug@gmail.com"}],"readme":"# latex-math-parser\n\n> A parser for LaTeX math expressions.\n\nThis parser converts LaTeX math syntax into an abstract syntax tree (AST) representation. It is built using PEG.js and supports a mostly complete set of standard LaTeX math expressions.\n\n## Installation\n\n```bash\nnpm install @andstor/latex-math-parser\n```\n\n## Usage\n\n```js\nconst { parse } = require('@andstor/latex-math-parser');\n\nconst latex = '\\\\frac{a}{b} + \\\\sqrt{x}';\nconst ast = parse(latex);\n\nconsole.log(JSON.stringify(ast, null, 2));\n```\n\n## Generators\n\nThis parser can be used with various code generators to convert the AST into different programming languages or formats. Currently supported generators include:\n- **[maxima-codegen](https://github.com/andstor/maxima-codegen)**: Maxima is a computer algebra system that can manipulate symbolic expressions.\n\n## Features\nThe complete grammar for this parser can be found at [src/grammars/latex.pegjs](src/grammars/latex.pegjs). Following are some of the key features supported by the parser:\n\n- **Arithmetic operations**: Addition, subtraction, multiplication, division, modulo, exponentiation, and implied multiplication.\n- **Logical and bitwise operations**: Logical AND/OR, bitwise AND/OR/XOR, relational and equality operators.\n- **Assignment expressions**: Standard and compound assignments (e.g., `=`, `+=`, `*=`, etc.).\n- **Function calls**: Built-in and user-defined functions, including support for argument lists and nested calls.\n- **Fractions**: Parsing of LaTeX `\\frac` expressions.\n- **Limits**: Parsing of limit expressions (e.g., `\\lim`).\n- **Logarithms**: Parsing of logarithms with arbitrary bases, including `\\log`, `\\ln`, and `\\lg`.\n- **Binomial coefficients**: Parsing of `\\binom`.\n- **Summations**: Parsing of `\\sum` with lower and upper bounds.\n- **Integrals**: Parsing of definite and indefinite integrals (`\\int`).\n- **Differentials**: Parsing of differential expressions.\n- **Trigonometric functions**: Parsing of all standard and inverse trigonometric functions.\n- **Roots**: Parsing of square roots and nth roots (`\\sqrt`).\n- **Absolute value**: Parsing of absolute value expressions.\n- **Grouping**: Parentheses and LaTeX groupings (`\\left(...\\right)`).\n- **Indexing**: Array and matrix indexing.\n- **Lists and sets**: Parsing of lists (`[1,2,3]`) and sets (`\\{1,2,3\\}`).\n- **Identifiers and constants**: Unicode and ASCII identifiers, mathematical constants (e.g., `\\pi`, `e`, `\\infty`).\n- **Numbers**: Integer and floating-point literals.\n- **Booleans and strings**: Parsing of boolean (`true`, `false`) and string literals.\n- **Matrix environments**: Parsing of LaTeX matrix environments (e.g., `matrix`, `pmatrix`, etc.).\n","readmeFilename":"README.md"}