Skip to content

Commit

Permalink
More assembly formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Dec 14, 2024
1 parent 892c500 commit 37d88ce
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ import { parse } from 'xcompile';

const ast = parse({
source: `# This is AT&T assembly
mov $100, %eax # move 100 into eax
mul $2, %eax # multiply the value in eax by 2
mov %eax,0x1000 # move eax's value into memory
nop # do nothing
mov $100, %eax # move 100 into eax
mul $2, %eax # multiply the value in eax by 2
mov %eax,0x1000 # move eax's value into memory
nop # do nothing
`,
literals: [
{ name: 'number', pattern: /^(0x)?\d+/ },
Expand Down Expand Up @@ -169,11 +170,13 @@ const json = JSON.parse(readFileSync('asm.json', 'utf-8'));

const ast = parse({
...config.parseJSON(json),
source: `# This is AT&T assembly
mov $100, %eax # move 100 into eax
mul $2, %eax # multiply the value in eax by 2
mov %eax,0x1000 # move eax's value into memory
nop # do nothing
source: `
# This is AT&T assembly
mov $100, %eax # move 100 into eax
mul $2, %eax # multiply the value in eax by 2
mov %eax,0x1000 # move eax's value into memory
nop # do nothing
`,
});

Expand Down

0 comments on commit 37d88ce

Please sign in to comment.