Past-paper question · 2018 October-November · Paper 33 · Q6(c)

Question 6(c) 2018 · October-November · Paper 33 · 2 marks

Original past-paper question for 6(C)
Original past-paper question for 6(C)
Original past-paper question for 6(C)
Reveal official mark-scheme answer Official mark-scheme answer for 6(C)

Official answer for Question 6

Part (c)

Question 1

mark per bullet point to max 2:

Question 2

✓
•
✓
constructing parse tree // parsing
✓
•
✓
checking the table of tokens to ensure that the rules/syntax/grammar of
✓
the language are/is obeyed
✓
•
✓
producing an error report

Mark scheme 9608_w18_ms_33.pdf →

Show text version of question

Question 6

Part (c)

Question 6

The compilation process has a number of stages. The first stage is lexical analysis.

A
compiler uses a keyword table and a symbol table. Part of the keyword table is shown.
  • Tokens for keywords are shown in hexadecimal.
  • All of the keyword tokens are in the range 00 – 5F.

Keyword Token 01 * 02 = 03

IF 4A THEN 4B ENDIF 4C ELSE 4D FOR 4E STEP 4F TO 50 INPUT 51 OUTPUT 52 ENDFOR 53

Entries in the symbol table are allocated tokens. These values start from 60 (hexadecimal).

Study the following code.

Start 1 INPUT Number // Output values in a loop FOR Counter Start TO 12 OUTPUT Number * Counter ENDFOR

Question 13

Part (c)

The output of the lexical analysis stage is the input to the syntax analysis stage.

Identify two tasks in syntax analysis.

1 ................................................................................................................................................

...................................................................................................................................................

2 ................................................................................................................................................

...................................................................................................................................................

[2]
Topic relevance

Why this question appears here

82% assigned-topic match · System software › Language translators

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9608_w18_qp_33.pdf

Keep practising this topic