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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:32:33+00:00 2026-06-07T23:32:33+00:00

Often I hear that using a symbol table optimizes look ups of symbols in

  • 0

Often I hear that using a symbol table optimizes look ups of symbols in a programming language. Currently, my language is implemented only as an interpreter, not as a compiler. I do not yet want to allocate the time to build a compiler, so I’m attempting to optimize the interpreter. The language is based on Scheme semantics and syntax for the most part, and is statically-scoped. I use the AST for executing code at run-time (in my interpreter, implemented as discriminated unions just like the AST in Write Yourself a Scheme in 48 Hours.

Unfortunately, symbol look-up in my interpreter is slow due to the use of an F# Map to contain and look up symbols by name. (Well, in truth, it uses a Trie, but the performance is similarly problematic). I would like to instead use a symbol tree to achieve faster symbol lookup. However, I don’t know if or how one can implement symbols tables in an interpreter. I hear about them only in the context of a compiler.

Is this possible? If the implementation strategy or performance differs from a symbol table in a compiler, could you describe the differences? Finally, is there an existing reference implementation of a symbol tree in an interpreter I might look at?

Thank you!

  • 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-06-07T23:32:35+00:00Added an answer on June 7, 2026 at 11:32 pm

    A symbol table associates some information with every symbol. In an interpreter, you would perhaps associate values with symbols. Map is one implementation particularly suitable for functional interpreters.

    If you want to optimize your interpreter, get rid of the need for a symbol table at runtime. One way to to go is De Bruijn idexing.

    There is also nice literature on mechanically deriving optimized interpreters, VMs and compilers from a functional interpreter, for example:

    http://www.brics.dk/RS/03/14/BRICS-RS-03-14.pdf

    For a simple example, consider lambda calculus with constants encoded with De Bruijn indices. Notice that the evaluator gets by without a symbol table, because it can use integers for lookup.

    type exp =
        | App of exp * exp
        | Const of int
        | Fn of exp
        | Var of int
    
    type value =
        | Closure of exp * env
        | Number of int
    
    and env = value []
    
    let lookup env i = Array.get env i
    let extend value env = Array.append [| value |] env
    let empty () : env = Array.empty
    
    let eval exp =
        let rec eval env exp =
            match exp with
            | App (f, x) ->
                match eval env f with
                | Closure (bodyF, envF) ->
                    let vx = eval env x
                    eval (extend vx envF) bodyF
                | _ -> failwith "?"
            | Const x -> Number x
            | Fn e -> Closure (e, env)
            | Var x -> lookup env x
        eval (empty ()) exp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I often hear complaints that programming languages that make heavy use of symbols for
I often hear around here from test driven development people that having a function
I often hear a Model must be wrapped by a ViewModel that the View
I often hear things like Can we load our employee info using LDAP? Yet,
I often hear that mongodb can perform atomicity at one collection level. Do you
Assembly is a language I'd like to learn but still you don't hear often
I often hear people say to use $_SERVER['SERVER_ADDR'] , but that returns the LAN
I often hear/read about interfaced based programming but I am not exactly clear on
You often hear that C++ is preferable to Objective-C for games, especially in a
One of the main advantages of web applications I often hear is that the

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.