Expression interpreters and cross-language integration

I helped maintain and extend an existing C++ library, adding functions, operators and types as part of a team. I individually developed its WebAssembly version to bring expression evaluation to the browser. My work combined core evolution and the cross-language bridge, with distinct scopes of authorship.

Contribution
Team and individual contribution Team-based library evolution and individual implementation of browser integration
Context
Professional library and cross-language integration experience

Context

Interpreter libraries turn text into a structure that can be validated and evaluated. Using that capability in another environment adds an integration boundary.

My contribution combines team-based work on an existing codebase and individual implementation of browser integration. This is professional experience, rather than a personal product.

Problem

Before an expression is evaluated, its elements must be recognized, precedence respected and operations checked against the types involved.

Across languages, value conversion, error representation and available operations need explicit contracts.

My contribution

I helped maintain and extend the existing C++ library, adding functions, operators and types as part of a team; I did not create the original core.

I individually developed the WebAssembly version and JavaScript integration to make evaluation available in the browser.

My experience also includes contributing to a Ruby/C++ integration with shared authorship.

Technical criteria

In the browser integration I developed, I reused the C++ core through WebAssembly rather than rewriting the interpreter in JavaScript. That approach brings existing behavior to another environment without creating a second implementation of interpretation.

My technical reasoning separates expression meaning from value transport across languages: the bridge needs understandable types, inputs, outputs and errors. A small example such as 2 + 3 * 4 explains precedence without exposing a professional grammar.

Alternatives and trade-offs

General criteria and technical analysis written for this portfolio.

  • Reusing a core can reduce divergence, but does not remove differences in numeric representation, memory or failure handling across environments.
  • Syntax and type validation are separate responsibilities. Text can be structurally valid while describing a meaningless operation.

Application and examples

The visuals on this page were written for the portfolio. They use common mathematics and predefined results without executing a professional library.

Independent example with predefined values: sqrt(9) + 7 splits into tokens and a tree. The square root of 9 becomes 3; then 3 + 7 becomes 10. Decorative rain uses only common mathematical operations. No interpreter runs.
  1. Tokenization

    Recognize numbers, operators and parentheses as separate elements of the text.

  2. Structure

    Organize elements according to precedence and grouping before evaluation.

  3. Validation

    Check operands and types. Text in a numeric multiplication produces an error in the example.

  4. Integration

    Define how values and errors cross the boundary between native code and the application using it.

Visualization

Stage 1 of 5: Expression

Valid formula

01 · Expression

quantity * price * (1 - discount)

02 · Tokens

  • quantityvariable
  • *operator
  • pricevariable
  • *operator
  • (parenthesis
  • 1number
  • -operator
  • discountvariable
  • )parenthesis

03 · Structure

Multiplication of (quantity × price) by (1 − discount). The parentheses make the subtraction happen before the final multiplication.

04 · Validation

  • Variables defined: quantity, price, discount
  • The * operator receives two numbers
  • The - operator receives two numbers

05 · Result

108

3 × 40 × (1 − 0.1) = 108

Example values: quantity = 3 · price = 40 · discount = 0.1

Formula with an error

01 · Expression

quantity * price * (1 - "10%")

02 · Tokens

  • quantityvariable
  • *operator
  • pricevariable
  • *operator
  • (parenthesis
  • 1number
  • -operator
  • "10%"text
  • )parenthesis

03 · Structure

Multiplication of (quantity × price) by (1 − "10%"). The structure is syntactically valid: the problem only shows up in semantic analysis.

04 · Validation

  • Variables defined: quantity, price
  • The * operator receives two numbers
  • The - operator receives a number and a text value

05 · Result

The "-" operator received a number and a text value. The formula is rejected before any calculation.

Example values: quantity = 3 · price = 40

Text description

Valid formula

  1. Expression: quantity * price * (1 - discount). The formula text, as someone would write it in a business rule.
  2. Tokens: quantity (variable), * (operator), price (variable), * (operator), ( (parenthesis), 1 (number), - (operator), discount (variable), ) (parenthesis).
  3. Structure: Multiplication of (quantity × price) by (1 − discount). The parentheses make the subtraction happen before the final multiplication.
  4. Validation: Variables defined: quantity, price, discount (ok); The * operator receives two numbers (ok); The - operator receives two numbers (ok).
  5. Result: 3 × 40 × (1 − 0.1) = 108

Formula with an error

  1. Expression: quantity * price * (1 - "10%"). The formula text, as someone would write it in a business rule.
  2. Tokens: quantity (variable), * (operator), price (variable), * (operator), ( (parenthesis), 1 (number), - (operator), "10%" (text), ) (parenthesis).
  3. Structure: Multiplication of (quantity × price) by (1 − "10%"). The structure is syntactically valid: the problem only shows up in semantic analysis.
  4. Validation: Variables defined: quantity, price (ok); The * operator receives two numbers (ok); The - operator receives a number and a text value (fails).
  5. Result: The "-" operator received a number and a text value. The formula is rejected before any calculation. Not evaluated. The error is reported before execution.
Conceptual illustration An independent educational example of interpretation and validation. Results are predefined; no evaluation library runs in the browser.

What this experience demonstrates

I developed a WebAssembly version that makes expression evaluation available in the browser, alongside team-based contributions to the C++ core. Individual authorship covers the browser version, not the entire library or every integration.

The demonstration on this page explains concepts with fictional data; it does not represent the grammar, catalogue or execution of the professional work.

Technologies

  • C++
  • WebAssembly
  • JavaScript
  • Parsing

Tell me about the problem you need to solve

Hiring for your team or solving a product problem? Share the context and the outcome you need. We can discuss a Senior Full Stack Developer or Tech Lead role, project development or technical consulting.

WhatsApp

+55 71 99705-3401

Opens WhatsApp with a starter message you can edit. Nothing is sent automatically.

You can also find me on GitHub and LinkedIn.