command_emul

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
program Himerus;
var words:array[1..4] of string;
com:string;
procedure Execom(str:string);begin;
if str='help' then begin
writeln('"?me ..words.." -- this is for the output from the third party.');
writeln('"?echo ..words.." -- this is for the output simple text.');
writeln('"?exit" -- this is for exit. :D');
end;
if str='me' then begin
var d:string;
d:=copy(com,4,length(com)-3);
writeln('%anon%',d);
end;
if str='echo' then begin
var d:string;
d:=copy(com,6,length(com)-5);
writeln('%anon% :',d);
end;
if str='exit' then HALT;
end;
procedure Error;begin;
writeln('// You re have a error in command');
end;
procedure Input;begin;
write('Input command : ');
readln(com);
end;
procedure Parcer(t: string);begin;
var index:integer;
var quic:string;
var readn:boolean;
readn:=false;
quic:=copy(t,1,1);
if quic<>'?' then Error;
if quic='?' then begin
quic:='';index:=2;
while readn<>true do begin
quic:=quic+copy(t,index,1);
index:=index+1;
for var i:=1 to 4 do begin;
if quic=words[i] then begin
readn:=true;
Execom(quic);
end;
end;
end;
end;
end;
begin
writeln('Hello, you are in Himerus-language test-console.');
writeln('Himerus is interpitation language. Dont laught, plz.');
writeln('Note: use "?help" for help. :3');
words[1]:='help';
words[2]:='me';
words[3]:='exit';
words[4]:='echo';
while 0=0 do begin
Input;
Parcer(com);
end;
end.