-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcat_asm.yml
49 lines (49 loc) · 2.63 KB
/
cat_asm.yml
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
in_source: |-
; Данный пример генерирует идентичный машинный код, что и программа на brainfuck:
;
; ,[.,]
;
; Каждый символ brainfuck соответствует одной инструкции на Asm.
input ; ,
loop:
jz break ; [
print ; .
input ; ,
jmp loop ; ]
break:
halt ; конец файла
in_stdin: |-
foo
out_code: |-
[{"index": 0, "opcode": "input", "term": [6, 0, "input"]},
{"index": 1, "opcode": "jz", "arg": 5, "term": [8, 0, "jz break"]},
{"index": 2, "opcode": "print", "term": [9, 0, "print"]},
{"index": 3, "opcode": "input", "term": [10, 0, "input"]},
{"index": 4, "opcode": "jmp", "arg": 1, "term": [11, 0, "jmp loop"]},
{"index": 5, "opcode": "halt", "term": [13, 0, "halt"]}]
out_stdout: |
source LoC: 13 code instr: 6
============================================================
foo
instr_counter: 11 ticks: 21
out_log: |
DEBUG machine:simulation TICK: 0 PC: 0 ADDR: 0 MEM_OUT: 0 ACC: 0 input ('input'@6:0)
DEBUG machine:signal_wr input: 'f'
DEBUG machine:simulation TICK: 2 PC: 1 ADDR: 0 MEM_OUT: 102 ACC: 0 jz 5 ('jz break'@8:0)
DEBUG machine:simulation TICK: 4 PC: 2 ADDR: 0 MEM_OUT: 102 ACC: 102 print ('print'@9:0)
DEBUG machine:signal_output output: '' << 'f'
DEBUG machine:simulation TICK: 6 PC: 3 ADDR: 0 MEM_OUT: 102 ACC: 102 input ('input'@10:0)
DEBUG machine:signal_wr input: 'o'
DEBUG machine:simulation TICK: 8 PC: 4 ADDR: 0 MEM_OUT: 111 ACC: 102 jmp 1 ('jmp loop'@11:0)
DEBUG machine:simulation TICK: 9 PC: 1 ADDR: 0 MEM_OUT: 111 ACC: 102 jz 5 ('jz break'@8:0)
DEBUG machine:simulation TICK: 11 PC: 2 ADDR: 0 MEM_OUT: 111 ACC: 111 print ('print'@9:0)
DEBUG machine:signal_output output: 'f' << 'o'
DEBUG machine:simulation TICK: 13 PC: 3 ADDR: 0 MEM_OUT: 111 ACC: 111 input ('input'@10:0)
DEBUG machine:signal_wr input: 'o'
DEBUG machine:simulation TICK: 15 PC: 4 ADDR: 0 MEM_OUT: 111 ACC: 111 jmp 1 ('jmp loop'@11:0)
DEBUG machine:simulation TICK: 16 PC: 1 ADDR: 0 MEM_OUT: 111 ACC: 111 jz 5 ('jz break'@8:0)
DEBUG machine:simulation TICK: 18 PC: 2 ADDR: 0 MEM_OUT: 111 ACC: 111 print ('print'@9:0)
DEBUG machine:signal_output output: 'fo' << 'o'
DEBUG machine:simulation TICK: 20 PC: 3 ADDR: 0 MEM_OUT: 111 ACC: 111 input ('input'@10:0)
WARNING machine:simulation Input buffer is empty!
INFO machine:simulation output_buffer: 'foo'