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 402507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:07:53+00:00 2026-05-12T17:07:53+00:00

I’m building a spreadsheet-like application, where a lot of small calculations needs to be

  • 0

I’m building a spreadsheet-like application, where a lot of small calculations needs to be stitched together in a tree-structure. These calculations are user-defined and I need a way for the user to enter them at runtime.

My current approach is to write a small “expression DSL” in F#, where I parse the input with FParsec, build a syntax tree based on a discriminated union and then can evaluate the expression. This works pretty well.

However, I’m thinking of looking in to basing the language on the DLR instead. Are there any upsides to go down this road (parse the input, generate the AST using the Scripting.AST stuff instead of my own, and let the DLR handle the execution of the calculation)?

Each calculation will probably be pretty small. The dependency between the calculations will be taken care of on a higher level.

Can I expect better performance since the DLR will generate CIL code for the expression or will the overhead eat that up?

(as for using an existing language like IronPython, it will probably be hard since I’m planning to add a lot of slice-and-dice operators and dimensionality-handling stuff to the language syntax)

  • 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-12T17:07:54+00:00Added an answer on May 12, 2026 at 5:07 pm

    It’s difficult to answer a question in such broad terms, but here are some of my thoughts.

    Using F# to build the parser sounds good.

    FSParsec is a great library. I’m kinda partial towards FSLex and FSYacc. Either way, in F# there are libraries specifically designed for parsing which save you time.

    Generating code with the DLR sounds OK.

    The DLR is a great platform for dynamic code generation. However, your application is much more specific. If you are limiting yourself to just computing values you should use the Expression Trees APIs from .NET 3.5. This API is designed for representing arbitrary code expressions. The DLR on the other hand is designed as a runtime or dynamic languages. I’m not saying it’s impossible, just that it isn’t the right tool for the job.

    Don’t compile your generated code.

    If you do go with the DLR to represent your AST, the cost of compiling and executing will likely be far greater than simply interpreting the tree. Do compile the code if: A.) you are executing the same function / method many times or B.) the function / method is very complicated.

    C# + DLR, IronPython, F#, or some combination of the three are all sound choices. Ultimately the ‘correct’ choice is the one that gets the job done in as quick of a time as possible.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.