Program
Open file
Read 5 bytes into begin
If begin == ‘BEGIN’
Call sentences
Read 3 bytes into end
If end == ‘END’
Success
Function sentences
Call VP
Call NP
Call period
Return
Function VP
Call
get_phrase
If tag ==
‘[VP]’
Lookup
word in verb table
If
found
Check
flag
If
flag = ‘P’
Write
(index, ‘VP’)
Else
if flag = ‘NP’
Find
index
Write(index,
‘VP’)
Else
Add
to table
Function NP
Call
get_phrase
If tag ==
‘[NP]’
Lookup
word in noun table
If
found
Record
position
Write
index, ‘NP’
Else
Add
to table
Function period
Read 1 byte
into period
If period
== ’.’
Return
success
Else ERROR
Function get_word
Set position
Peek next
If next <> ‘[’
Read one byte into word
Loop
Call tag
Return word
Function get_tag
Read 4 bytes into tag
Return tag
Function get_phrase
Call get_word
Call get_tag
Return tagged_phrase
Tags: