Rabu, 13 April 2011

mengoreksi spasi antar kata menggunakan editor 'vi' UNIX


Contoh:
Tugas editing menggunakan editor ‘vi’ UNIX.
Tugasnya mengoreksi spasi antar kata.


Production rules CCT:
(SELECT-INSERT-SPACE
IF (AND (TEST-GOAL perform unit task)
(TEST-TEXT task is insert space)
(NOT (TEST-GOAL insert space))
(NOT (TEST-NOTE executing insert space)))
THEN ( (ADD-GOAL insert space)
(ADD-NOTE executing insert space)
(LOOK-TEXT task is at %LINE %COL)))
(INSERT-SPACE-DONE
IF (AND (TEST-GOAL perform unit task)
(TEST-NOTE executing insert space)
(NOT (TEST-GOAL insert space)))
THEN ( (DELETE-NOTE executing insert space)
(DELETE-GOAL perform unit task)
(UNBIND %LINE %COL))
(INSERT SPACE-1
IF (AND (TEST-GOAL insert space)
(NOT (TEST-GOAL move cursor))
(NOT (TEST-CURSOR %LINE %COL)))
THEN ( (ADD-GOAL move cursor to %LINE %COL)))
(INSERT SPACE-2
IF (AND (TEST-GOAL insert space)
(TEST-CURSOR %LINE %COL))
THEN ( (DO-KEYSTROKE ‘I’)
(DO-KEYSTROKE SPACE)
(DO-KEYSTROKE ESC)
(DELETE-GOAL insert space)))

Tidak ada komentar: