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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:16:59+00:00 2026-05-27T23:16:59+00:00

How is the semantic analysis done by a compiler (generally)? I had to answer

  • 0

How is the semantic analysis done by a compiler (generally)?

I had to answer to this question during my last exam, it wasn’t enough for the professor.

I included BNF (with an example) and syntactic cards in my answer, to which he asked me: “What happens when the compiler finds a statement like int i;?”

  • 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-27T23:17:00+00:00Added an answer on May 27, 2026 at 11:17 pm

    Time to read Aho&Ullman/Dragon book carefully.

    Semantic analysis is the activity of a compiler to determine what the types of various values are, how those types interact in expressions, and whether those interactions are semantically reasonable. For instance, you can’t reasonably multiply a string by class name, although no editor will stop you from writing

     "abc" * MyClass
    

    To do this, the compiler must first identify declarations and scopes, and typically records the result of this step in a set of symbol tables. This tells it what specific identifiers means in specific contexts. It must also determine the types of various literal constants; “abc” is a different type than 12.2e-5.

    Then it must visit all locations where identifiers and literals are used, and verify that the use of the identifier/literal, and the results computed, are compatible with the language definition (as in the above example).

    As to how this is done: typically the source code is parsed, some representation of the program is constructed (syntax trees are very popular), and that representation is walked (“visited”) element by element to collect/validate the semantic information. The symbol table is usually just a set of hash tables associated with the syntax tree representing a scope, hashing from identifiers to structures containing type declarations.

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

Sidebar

Related Questions

I came across this term called 'Explicit Semantic Analysis ' which uses Wikipedia as
What is the usefulness of W3C's Semantic Data Extractor ? http://www.w3.org/2003/12/semantic-extractor.html This tool, geared
I have a tree parser that's doing semantic analysis on the AST generated by
Can semantic errors be detected by the compiler or not? If not when do
We use the wonderful semantic versioning paradigm when versioning our rails app. One question
I'm considering about adding semantic analysis to my Solr installation, but I don't exactly
I would like to implement Latent Semantic Analysis (LSA) in PHP in order to
This is more of a conceptual question than an actual implementation and am hoping
I want to use Latent Semantic Analysis for a small app I'm building, but
So I get this warning : Semantic Issue: Incompatible pointer to integer conversion sending

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.