Formula Parser-JEP removal

From PCGen Wiki
Jump to: navigation, search

Background

From a code team discussion about tasks for PCGen 5.17, it was brought up that one project was additional work on formula processing, JEP, output sheets. This discussion effectively starts in message DEV_2. This discussion led to considering the removal of JEP from PCGen.

Status

This Wiki is a summary page, it is NOT intended to host the discussion - please do not use it to carry on discussion.

A detailed proposal (please don't discuss on this page EITHER) is on Formula Parser Equip Vars Proposal

Reasoning

The long-term discussion/proposal is around removing JEP from PCGen. This is a result of

  1. JEP is now a closed source library, so we cannot continue to benefit from future releases/bug fixes
  2. JEP is a license exception in our code, which restricts our license flexibility
  3. JEP has more features than we need (some of which get in our way)

Requirements

The following are the currently identified (proposed) requirements for a Formula Parser for PCGen:

  1. Recognize the bits that make up a PCGEN formula
  2. Follow mathematical precedence for operators
  3. Do not involve tens (hundreds) of recursive calls every time we evaluate a formula.
  4. Have the ability to complain at LST load (vs at runtime) if a formula is invalid, which means it also has the ability to detect and warn at LST load for deprecated formula styles, e.g. 2MAXINT

Potential Implementation Details/Future projects:

  1. Have a formula factory that can detect situations where a formula like 1+INT is used multiple places in the LST. These should be reduced via a cache to a single Formula object (since a Formula is immutable) to save memory and hopefully reduce LST load time.
  2. Make formula terms/variables into plugins, so the Formula system can be extended without modifying the core.

Proposal

Being developed, please see pcgen_developers list for current status.