
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
= Exalted Math Parser
This is a very simple project both to teach myself to use Treetop, and to implement simple (or not so simple) parsing of mathematics for Exalted character sheets. Although I'm sure it could be used for other simple math situations. It consists of two parts; parser and abstract syntax tree. The parser constructs the abstract syntax tree as it parses the input string. The AST can then be used to compute the value of the expression with a given context. The AST can also simply itself, factoring out constant operations in some cases.
== Examples
@parser = ExaltedMath::MathsParser.new
# simple maths
# The parser returns the AST
# it raises a ParseFailedError in the case of error
@parser.ast('3 + 4')
#=> simple_ast
# symbolic values
@parser.ast('Essence * 4')
#=> symbolic_ast
# complex maths
@parser.ast('(Essence * 4) + Willpower + highest[2](Compassion,Conviction,Temperance,Valor)')
#=> complex_ast
# evaluate the Ast
simple_ast.value
#=> 7
# evaluate a more complex Ast
symbolic_ast.value({'essence' => 4})
#=> 16
== Syntax
The syntax supported by the parser is pretty simple. In the examples above, almost all of it has been demonstrated.
[[0-9]+] A number [[A-Za-z]+] A stat. This is looked up from the context. [spec:"..."] A speciality. This is looked up from the context. [highest(stat|number,...)] Has the value of the highest component. [highestn] Has the value of the highest n components. [lowest(stat|number,...)] Has the value of the lowest component. [lowest2] Has the value of the lowest n components.
FAQs
Unknown package
We found that exalted_math demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.