컴 파일 원리 프로 그래 밍 실천 (9) 컴 파일 및 테스트
2. Makefile 과 main. cpp 파일 을 같은 디 렉 터 리 에 복사 합 니 다.
3. MinGW Shell 에서 코드 가 있 는 디 렉 터 리 에 cd 명령 으로 들 어가 make 명령 을 실행 합 니 다.
MinGW 경로 가 Liux 와 유사 하 므 로 cd / f / projects 와 유사 한 명령 으로 디 렉 터 리 에 들 어가 야 합 니 다.
4. 1. txt 파일 을 준비 합 니 다. 내용 은?
const a =10;
var b,c;
procedure p;
begin
c:= b+a;
end;
begin
read(b);
while b#0 do
begin
call p
;write(2*c)
;read(b)
end
end
.
5. 실행. / main. exe 는 전체 운행 과정 이 다음 과 같다.
$ ./main.exe
input file? 1.txt
list object code ?Y
0 const a =10;
1 var b,c;
1 procedure p;
1 begin
3 c:= b+a;
7 end;
2 int 0 3
3 lod 1 3
4 lit 0 10
5 opr 0 2
6 sto 1 4
7 opr 0 0
8 begin
9 read(b);
11 while b#0 do
15 begin
15 call p
16 ;write(2*c)
20 ;read(b)
23 end
23 end
24 .
8 int 0 5
9 opr 0 16
10 sto 0 3
11 lod 0 3
12 lit 0 0
13 opr 0 9
14 jpc 0 24
15 cal 0 2
16 lit 0 2
17 lod 0 4
18 opr 0 4
19 opr 0 14
20 opr 0 15
21 opr 0 16
22 sto 0 3
23 jmp 0 11
24 opr 0 0
start pl0
?2
24
?4
28
?0
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.