.data
.bss
.lcomm nums, 30
.lcomm source, 10
.lcomm dest, 10
.text
.global _start
_start:
movq $source, %rsi
movq $1, (%rsi)
movq $2, 1(%rsi)
movq $3, 2(%rsi)
movq $source, %rsi
movq $dest, %rdi
movq $3, %rcx
cld
rep movsb
preShowNums:
movzbq (%rdi), %rax
leaq nums, %rsi
movq $29, %rbx
showNums:
movq $10, %rcx
xorq %rdx, %rdx
divq %rcx
movb $48, (%rsi, %rbx, 1)
addb %dl, (%rsi, %rbx, 1)
decq %rbx
cmpq $0, %rax
ja showNums
movq $1, %rax
movq $1, %rdi
movq $nums, %rsi
movq $30, %rdx
syscall
movq $60, %rax
xorq %rdi, %rdi
syscall
.end
class Token {
public:
char kind;
int value;
Token(char k, int v) {
kind = k;
value = v;
}
Token(char k) {
kind = k;
value = 0;
}
};
class Token_stream {
public:
Token_stream() {
buffer = 0;
full = false;
}
void putback(Token t);
Token get();
private:
Token buffer;
bool full;
};