Chapter 4: Syntax Analysis

Example: Top down Parsing

. Following grammar generates types of Pascal

type simple

|id

| array [ simple] of type

simple integer

| char

| num dotdot num

Top-down parsing is a strategy of analyzing unknown data relationships by hypothesizing general parse tree structures and then considering whether the known fundamental structures are compatible with the hypothesis. For example, the following grammar generates the types in Pascal language by starting from type and generating the string:

type simple

|id

| array [ simple] of type

simple integer

| char

| num dotdot num