Compilers and Usage(Unsung Heros??)

Hi,

This is a very generic topic, I tried to read some articles related to compiler. As such which we read in our bachelor's degree about Compiler Design. But I will try to make a series since it is long topics i might try some Algorithms on types of Compilers and How computer understands the code.

What is Compiler?

Going by book, It is tool in a software Development process which translates high level language to low level language(machine code) which computer understands. The process is as followed up:

  • Scanning (Lexer):

The scanner (also known as the lexer) breaks down the source code into smaller units called tokens.

For example, the word “for” becomes the constant For, and the characters ... become DotDotDot.

  • Parsing (Parser):

The parser constructs a syntax tree from the tokens.

The syntax tree represents the hierarchical structure of the program.

  • Type Checking:

The type checker ensures that expressions and statements adhere to the language’s type rules.It verifies that you’re not trying to add an integer to a string, for instance.

  • Intermediate Representation (IR) Construction (“Noding”):

The compiler generates an intermediate representation (IR) from the syntax tree.

The IR simplifies further analysis and optimization.

  • Middle End:

This phase includes various optimizations, such as dead code elimination.

The goal is to improve the efficiency of the compiled code.

  • Generating Machine Code:

Finally, the compiler produces machine code (binary instructions) that the CPU can execute.


With the intriguing looking into article of Modular which uses MILR ,Java use JVM architecture ,i got into Article of Golang Internal:

Link reference : Golang Internal Compiler

I am taking the example same as the article which i went through the article

i := 4
until i == 0 {
  i--
  fmt.Println("Hello, until!")
}        

Step-by-Step Exploration

  • Scan (Lexer):

The scanner tokenizes the input code.

Keywords like until become constants.

  • Parse (Parser):

The parser constructs a syntax tree.

We’ll modify it to recognize the until statement.

  • Type Checking:

We ensure that the until statement adheres to Go’s type rules.

  • IR Construction (“Noding”):

We generate an intermediate representation (IR) for the until statement.

  • Middle End (Optimization):

We apply any necessary optimizations.

  • Generate Machine Code:

Finally, we produce machine code for the modified program.


I know most of these topic are known to all but neglected by many, just a refresher , next article i will try to tell types of Lexical and how A* Algorithm keep the code completion work . Lot of stuff to learn and share.

Thanks for Reading??. Hope you like it.

要查看或添加评论,请登录

Sumit Patnaik的更多文章

  • Deep-Dive on Siebel Open UI File

    Deep-Dive on Siebel Open UI File

    Hi, This is just continuation of Open UI Series. Please check out if you want refresher or want to know about it.

    1 条评论
  • Should we move from JMS implementation to Kafka

    Should we move from JMS implementation to Kafka

    As we are navigating to complexities of modern business needs, our software need to upgrade accordingly . Most system…

  • Building Blocks of Order Management : Understanding the Entities of COM(Customer Order Management)

    Building Blocks of Order Management : Understanding the Entities of COM(Customer Order Management)

    Hi, This article will not be full fledged covering on Customer Order Management nor it can be explained with single…

    1 条评论
  • Orchestrater - Build and Design

    Orchestrater - Build and Design

    Hi, I have been reading the book "Build an Orchestrator in Go" By Tim Boring for last 3 weeks . I would like to share…

  • Toolbar in Siebel and its Significance

    Toolbar in Siebel and its Significance

    Hi, I was reading Alexander Hansal Siebel CRM Handbook and came across the article about Toolbar and Menu addition into…

  • Streamlining Order Management: A Key to Success in Communications

    Streamlining Order Management: A Key to Success in Communications

    In the fast-paced world of communications, efficient order management is crucial for delivering seamless customer…

    1 条评论
  • Kafka and Use case Benefit with Siebel

    Kafka and Use case Benefit with Siebel

    Hi, This is similar to post i made earlier but better use case example we can cater in real world Before Diving Deep…

    2 条评论
  • Understanding Siebel Integration Object Base Type

    Understanding Siebel Integration Object Base Type

    Dive into this insightful of the article and feel free to share your thought. Below are types and some example: 1.

  • User Experience with Siebel CRM

    User Experience with Siebel CRM

    Hi, I already briefed about Open UI and its component in the previous articles. I will try to cater the components…

  • 5. Nuances of SIS OM

    5. Nuances of SIS OM

    Hi, This article is more about one BS itself "SIS OM" and how important is this function and what all Siebel provides…

    5 条评论

社区洞察

其他会员也浏览了