nrml
StringsStripe

Transaction Rule Parser

Repair ordered transaction decisions, evaluate Boolean conditions, and support nested groups.

The scenario

Extend a transaction rule processor from string matching to Boolean expressions and nested conditions. This original nrml practice is informed by community reports about Stripe; its precise grammar, starter, and test cases are authored for practice.

A failure to reason about

A trusted merchant can match an early acceptance rule and a later blocking rule. The rule order determines the decision. A merchant name containing OR is still one string value.

Illustrative context for the topic. The exercise’s full requirements arrive in the workspace.

Questions to bring to your review

  • Which matching rule determines the transaction outcome?
  • How do you distinguish an operator from the same text inside a quoted name?
  • How should a parser handle flat expressions and parenthesized groups?
  • Which regression cases preserve earlier behavior as the grammar grows?

Skills you will practice

  • Tokenization
  • Parser state
  • Boolean evaluation
  • Rule ordering
  • Testing

Read the existing code, reproduce the reported behavior, review proposed changes, and verify your final implementation. You can use AI assistance while staying responsible for the result.

Prepare with a worked example

See how nrml evaluates an attempt, including the limits of automated evidence.