Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 667855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:58:29+00:00 2026-05-13T23:58:29+00:00

I’m trying to enable dynamic fields in the configuration file for my mapping app,

  • 0

I’m trying to enable dynamic fields in the configuration file for my mapping app, but I can’t figure out how to parse the “equation” passed in by the user, at least not without writing a whole parser from scratch! I’m sure there is some easier way to do this, and so I’m asking for ideas!

Basic idea:

public var testString:String = "(#TOTPOP_CY#-#HISPOP_CY#)/#TOTPOP_CY#";
public var valueObject:Object = {TOTPOP_CY:1000, HISPOP_CY:100};
public function calcParse(eq:String):String {
// do calculations
return calculatedValue
}

So far, I was thinking of splitting the expression by either the operators, or maybe the variable tokens, but that gets rid of the parenthetical nesting. Alternatively, use a series of regex to search and replace each piece of the expression with its value, recursively running until only a number is left. But I don’t think regex does math (i.e. replace “\d + \d” with the sum of the two numbers)
Ideally, I’d just do a find/replace all variable names with their values, then run an eval(), but there’s no eval in AS…

eesh

I downloaded some course materials for a course on compiler design, so maybe I’ll just write a full-fledged calculator language and parser and port it over from the OTHER flex (the parser generator) 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:58:29+00:00Added an answer on May 13, 2026 at 11:58 pm

    First things first, this isn’t really a regex problem.

    Next, if you want to use a compiler generator in as3, don’t use flex. Use ANTLR, it can target AS3 for output (no need to port it from C). (http://www.antlr.org)

    Finally, check out the algorithms for infix to postfix conversion. Here’s the wikipedia article on it. (http://en.wikipedia.org/wiki/Shunting-yard_algorithm)
    It’s not too tough to implement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 375k
  • Answers 375k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer See this Microsoft Feedback report. From the article: The error… May 14, 2026 at 8:23 pm
  • Editorial Team
    Editorial Team added an answer I've said there's no direct equivalent of the C++ "friend"… May 14, 2026 at 8:23 pm
  • Editorial Team
    Editorial Team added an answer Just like real Zombies, Zombie processes can't be killed -… May 14, 2026 at 8:23 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.