
















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















































COMP 524 Programming Language Concepts Stephen Olivier January 20, 2009 Based on notes by A. Block, N. Fisher, F. Hernandez-Campos, J. Prins and D. Stotts
Scanner (lexical analysis) Parser (syntax analysis) Semantic analysis & intermediate code gen. Machine-independent optimization (optional) Target code generation. Machine-specific optimization (optional) Symbol Table Character Stream Token Stream Parse Tree Abstract syntax tree Modified intermediate form Machine language Modified target language
We skip any initial white spaces we read the next character if it is a ( we look at the next character if that is a * we have a comment; we skip forward through the terminating *) otherwise we return a ( and reuse the look-ahead If it is one of the one-character tokens ([],;=+- etc.) we return that token ...
We skip any initial white spaces we read the next character if it is a ( we look at the next character if that is a * we have a comment; we skip forward through the terminating *) otherwise we return a ) and reuse the look-ahead If it is one of the one-character tokens ([],;=+- etc.) we return that token ...
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 non_zero_digit → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 natural_number → non_zero_digit digit* non_neg_number → (0 | natural_number ) ( (. digit* non_zero_digit ) | ε )
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 non_zero_digit → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 natural_number → non_zero_digit digit* non_neg_number → (0 | natural_number ) ( (. digit* non_zero_digit ) | ε )
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 non_zero_digit → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 natural_number → non_zero_digit digit* non_neg_number → (0 | natural_number ) ( (. digit* non_zero_digit ) | ε )
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 non_zero_digit → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 natural_number → non_zero_digit digit*
non_neg_number → (0 | natural_number ) ( (. digit* non_zero_digit ) | ε )
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 non_zero_digit → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 natural_number → non_zero_digit digit*
non_neg_number → (0 | natural_number ) ( (. digit* non_zero_digit ) | ε )
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 non_zero_digit → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 natural_number → non_zero_digit digit*
non_neg_number → (0 | natural_number ) ( (. digit* non_zero_digit ) | ε )
digit → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 non_zero_digit → 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 natural_number → non_zero_digit digit*
non_neg_number → (0 | natural_number ) ( (. digit* non_zero_digit ) | ε )