Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That would be lexical analysis.</p> <p>Some languages have "special" identifiers as well as keywords. These are often added to the identifier table and allocated known constant ID values before the parsing starts, so that they can be spotted easily. These don't normally have special meaning to the parser, though - they should be detected in the abstract syntax tree (AST) after parsing.</p> <p>For example, take a look at the Oberon language report...</p> <p><a href="http://www-old.oberon.ethz.ch/oreport.html" rel="nofollow">http://www-old.oberon.ethz.ch/oreport.html</a></p> <p>Not a language recommendation - just an easily available and simple language specification (very much Wirths style).</p> <p>Anyway, the "Vocabulary and representation" section includes a list of "operators and delimiters", including what most people would recognise as keywords. These would be recognised by the lexical analyser.</p> <p>In the "Declarations and scope rules" section, there's a list of predefined identifiers such as "ABS" and "BOOLEAN". I'm not familiar enough with Oberon to be certain, but if I were to write a compiler, there's a good chance I'd just pre-initialise the normal identifier table to include these predefined identifiers.</p> <p>In C, "main" is in most ways just another function. The compiler may or may not treat it as special. It's possible that the only "special" thing about it is that the startup code that gets linked into your final executable makes a call to that function.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload