about summary refs log tree commit diff
path: root/evoke.e
blob: 823866f4f8024c2d7baa511ea918e373b180d069 (plain)
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
77
78
79
80
81
82
~ echo 's" evoke.e" enchant' | ./evoke > evoke2 && chmod 755 evoke2
~ echo 's" evoke.e" inscribe' | ./evoke > evoke.hex

~ (output memory start, current output point
~  -- output memory start, current output point)
: compile-header
  ~ :   This particular program is 'evoke', the compiler. If you already have
  ~ : a binary copy of 'hex', run this file through it and you'll have a
  ~ : working compiler. Pretty sweet, right?
  ~ :
  ~ :   If you're auditing this by hand, first off, thank you for doing that.
  ~ : You may wish to pull up the source code side-by-side with the hex dump;
  ~ : there's a lot of structural stuff in the actual source that aids in
  ~ : readability but isn't easily reproduced in this form, though every
  ~ : effort has been made.
  ~ : blank-line
  0x08000000 L!' origin ;


~ (output memory start, current output point
~  -- output memory start, current output point)
: compile-footer
  ~   If we wanted words in the log to be able to call statically-linked
  ~ words, we could set this to something nonzero. We don't, so we leave it
  ~ alone.
  0 L!' final-word-name

  current-offset L!' total-size
  ~ : blank-line
  ~ : This is the end of the hex dump. Thanks for reading!
  ;


: define-compilation
  allocate-compilation-definition
  ~ (definition)

  [ current-input-file-name literal-string ]
  over compilation-definition-top-level-filename !

  here @ dup
  s" language/static/core.e" packstring
  s" language/static/linux.e" packstring
  s" language/static/output.e" packstring
  s" language/static/amd64.e" packstring
  s" language/static/execution-support.e" packstring
  s" language/static/log-load.e" packstring
  0 pack8 8 packalign here !
  over compilation-definition-static-filenames !

  here @ dup
  s" language/dynamic/dynamic.e" packstring
  s" language/dynamic/input.e" packstring
  s" language/dynamic/interpret.e" packstring
  s" language/dynamic/flow-control.e" packstring
  s" language/dynamic/linux.e" packstring
  s" language/dynamic/files.e" packstring
  s" language/dynamic/command-line.e" packstring
  0 pack8 8 packalign here !
  over compilation-definition-dynamic-filenames !

  here @ dup
  s" compilation/labels.e" packstring
  s" compilation/elf.e" packstring
  s" compilation/transform.e" packstring
  s" compilation/execution.e" packstring
  s" compilation/top-level.e" packstring
  s" language/boot-source-footer.e" packstring
  0 pack8 8 packalign here !
  over compilation-definition-boot-filenames !

  x' compile-header
  over compilation-definition-compile-header !

  x' compile-footer
  over compilation-definition-compile-footer !

  s" evoke-executable-data" variable ;
define-compilation

: latest-executable-data evoke-executable-data ;