#include <perms.h>
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %option "check, diag" ;! I have modified pass1-flat.c to extract the string and assign it to char OPTION_STRING[256]
// 2
// 3 %option "#pragma push_macro(""macro_name"")" ;! Thinking this might help communicate with C... Better syntax than using '*' to pretend it is machine code...
// 4
// 5 %option "
// 6+ int zxcv(void) {
// 7+ return 42;
// 8+ }
// 9+ "
// 10
// 11 %option "-last-man-standing" ;! for now only the last parameter to %option will be available to the caller of pass1 when it exits.
// 12
// 13 ! The next two are passed into the ICode. They only accept 16-bit integers.
// 14
// 15 %diagnose 16_5678 ;! only affects compiler reporting, should not make any change to generated code
// _imp_diagnose(0x5678); /* %diagnose is a compiler directive and does not generate code */
// 16
// 17 %control 16_abcd ;! control code generation.
// _imp_control(0xabcd); /* %control is a compiler directive and does not generate code. */
// 18
// 19 ! Some meanings of some bits from some previous compilers. They are far from being standardised.
// 20
// 21 ! %control 0 ; ! NO CHECKING
// 22 ! %control 1 ; ! CHECK SWITCHES
// 23 ! %control X'10000000' ; ! Decode to machine code in listing file. (EMAS, 32-bit parameter accepted)
// 24
// 25
// 26 ! ABD 80386:
// 27
// 28 !CONTROL BITS
// 29 %constinteger check capacity = 1
// 30 %constinteger check unass = 2
// 31 %constinteger check array = 4
// 32 %constinteger check bits = check array;lookup: 911 0 441233
// ! The only one that does anything so far
// 33
// 34 ! PDP11:
// 35 %constinteger Trusted = 1<< 0,
// 36+ No Eis = 1<< 8,
// 37+ Stack Check = 1<< 9,
// 38+ Profiling = 1<<10,
// 39+ Check Jumps = 1<<11
// 40
// 41 ! Early ICL 4/75 imp compiler:
// 42
// 43 ! K=J &15; LINENOS = K %UNLESS K=15
// 44 ! K=J>> 4 &15; DIAGS1 = K %UNLESS K=15
// 45 ! K=J>> 8 &15; CHECKS = K %UNLESS K=15
// 46 ! CHECKSP = K&14 %UNLESS K=15
// 47 ! K=J>>12 &15; UNASS = K %UNLESS K=15
// 48 ! 16 unknown
// 49 ! 20 unknown
// 50 ! 24 unknown
// 51 ! K=J>>28; DCOMP = K %UNLESS K=15
// 52
// 53 ! INTERDATA
// 54
// 55 ! COMPILER CONTROL OPTIONS (DEFAULT MARKED *)
// 56 %CONSTINTEGER TEST SWITCH = 1; !* CHECK SWITCH JUMPS
// 57 %CONSTINTEGER STKDIAG = 2; !* CHECK EXTENT OF STACK
// 58 %CONSTINTEGER ARRAY DIAG = 4; !* CHECK ARRAY BOUNDS
// 59 %CONSTINTEGER FORDIAG = 8; !* VALIDATE %FOR PARAMETERS
// 60 %CONSTINTEGER ASS DIAG =16; !* TEST FOR TRUNCATION
// 61 %CONSTINTEGER UNASS DIAG =32; !* CHECK FOR UNASSIGNED VARIABLES
// 62 !
// 63 %CONSTINTEGER TRUSTED diag =4096; ! ENABLE DIRTY OPTIMISATIONS
// 64 ! %CONTROL 0 GIVES TIGHTEST CODE (NO CHECKING AT ALL!)
// 65
// 66 !----------------------------------------------------------------------------------------
// 67 ! %diagnose is also somewhat compiler-specific
// 68
// 69
// 70 ! VAX: (pass 2)
// 71
// 72 ! %diagnose significance
// 73 !
// 74 ! diag bit: monitors:
// 75 ! 1 = stack procedures
// 76 ! 2 = load
// 77 ! 4 = hazard/claim/release
// 78 ! 8 = assign/array ref
// 79 ! 16 = call/push
// 80 ! 32 = address
// 81 ! 64 = amap/vmap
// 82 ! 128 = put code/operand
// 83 ! 256 = operate
// 84 !
// 85 ! 2048 = I-code main symbols
// 86 ! 4096 = stack dump on MONITOR
// 87 ! 8192 = %monitor on MONITOR
// 88
// 89
// 90 ! Early Imp77 v4.12 (1978) pass1
// 91 ! %DIAGNOSE FLAGS (2\\N)
// 92 !
// 93 ! 0 - GRAMMAR TRACE
// 94 ! 1 - RECORD USE
// 95 ! 2 - APP DEFN.
// 96 ! 3 - RECORD DEFN.
// 97 !
// 98
// 99 ! later pass1:
// 100
// 101 !%diagnose 16_800F { Mon Codes ! Mon ICode | Mon Line | Mon Debug }
// 102 !diagnostic trace routine (diagnose&1 # 0)
// 103
// 104
// 105 ! The Perkin-Elmer compiler encodes the pass number that the %diagnose refers to
// 106 ! in the top two bits of the 16-bit word. This probably explains the 800F
// 107 ! above, which means those codes were intended for Pass1...
// 108
// 109 ! c('y'): ! %diagnose n
// 110 ! j = tag
// 111 ! diagnose = 0
// 112 ! %if (j>>14)&3 = 2 %start; ! it's for pass 2
// 113
// 114
// 115 %endoffile