view interps/clc-intercal/CLC-INTERCAL-Base-1.-94.-2/INTERCAL/Include/iacc.iacc @ 12518:2d8fe55c6e65 draft default tip

<int-e> learn The password of the month is release incident pilot.
author HackEso <hackeso@esolangs.org>
date Sun, 03 Nov 2024 00:31:02 +0000
parents 859f9b4339e6
children
line wrap: on
line source

PLEASE NOTE THAT THIS PROGRAM IS A COMPILER GENERATOR
(IACC - INTERCAL ADVANCED COMPILER COMPILER)

Copyright (c) 2006-2008 Claudio Calvelli, all rights reserved.

CLC-INTERCAL is copyrighted software. However, permission to use, modify,
and distribute it is granted provided that the conditions set out in the
licence agreement are met. See files README and COPYING in the distribution.

TO COMPILE A COMPILER:

    sick --preload=iacc --batch compiler.iacc

TO USE A COMPILER COMPILED WITH IACC:

    sick --preload=compiler --batch program.i

THIS FILE IS ALSO AVAILABLE AS A PREBUILT COMPILER (iacc.io).
TO REBUILD AFTER MODIFYING THIS FILE:

    sick --preload=iacc --batch iacc.iacc

END OF THE USAGE INSTRUCTIONS

PERVERSION "CLC-INTERCAL INTERCAL/Include/iacc.iacc 1.-94.-2"

PLEASE NOTE: INITIAL VALUES FOR REGISTERS
	DO %PS <- ?PROGRAM
	DO %IS <- #0
	DO %FS <- ?CALC_FULL
	DO %ES <- ?CALC_EXPR
	DO %JS <- ?END_JUNK
	DO %SS <- ?SPACE
	DO %IO <- ?CLC
	DO %CR <- ?ASCII
	DO %CW <- ?ASCII
	DO ?TYPE <- ?IACC

PLEASE NOTE: DETERMINE WHERE JUNK ENDS
	DO CREATE _2 ?END_JUNK ?DO_PLEASE AS ,,

PLEASE NOTE: COMPILER COMPILER STARTS HERE
	DO CREATE _2 ?BYTECODE ?SPECIAL_REGISTER=* AS ?SPECIAL_REGISTER
	   #1

	DO CREATE _2 ?BC_OR_CONST ?BYTECODE=* AS ?BYTECODE #1
	DO CREATE _2 ?BC_OR_CONST ,#35, ?CONSTANT=1 AS ?CONSTANT #1

	DO CREATE _2 ?BC_LIST ?BC_OR_CONST=* AS ?BC_OR_CONST #1
	DO CREATE _2 ?BC_LIST ?BC_OR_CONST=* ,#43, ?BC_LIST=* AS
	   ?BC_OR_CONST #1 + ?BC_LIST #1

	DO CREATE _2 ?NONBINARY ,#35, ?CONSTANT AS ?CONSTANT #1
	DO CREATE _2 ?NONBINARY ?SPECIAL_REGISTER AS ?SPECIAL_REGISTER
	   #1
	DO CREATE _2 ?NONBINARY ,#44, ,#63, ?E_LIST ,#44, AS MUL +
	   !E_LIST #1 + ?E_LIST #1
	DO CREATE _2 ?NONBINARY ,#63, ?SYMBOL AS ?SYMBOL #1
	DO CREATE _2 ?NONBINARY ,#39, ?EXPRESSION ,#39, AS ?EXPRESSION
	   #1
	DO CREATE _2 ?NONBINARY ,#34, ?EXPRESSION ,#34, AS ?EXPRESSION
	   #1
	DO CREATE _2 ?EXPRESSION ?NONBINARY ?MAYBE_BINARY AS
	   ?MAYBE_BINARY #1 + ?NONBINARY #1
	DO CREATE _2 ?MAYBE_BINARY ,, AS ,,
	DO CREATE _2 ?MAYBE_BINARY ?BINARY ?EXPRESSION AS ?BINARY #1 +
	   ?EXPRESSION #1

	DO CREATE _2 ?BINARY ,#162, AS RIN
	DO CREATE _2 ?BINARY ,#126, AS RSE

	DO CREATE _2 ?E_LIST ?EXPRESSION=1 AS ?EXPRESSION #1
	DO CREATE _2 ?E_LIST ?EXPRESSION=1 ,#43, ?E_LIST=* AS
	   ?EXPRESSION #1 + ?E_LIST #1

	DO CREATE _2 ?CLEFT ?EXPRESSION AS #0 + ?EXPRESSION #1
	DO CREATE _2 ?CLEFT ?TAILS AS #1 + ?TAILS #1
	DO CREATE _2 ?CLEFT ,#44, ,#44, AS #1 + STR + #0
	DO CREATE _2 ?LEFT ?CLEFT ?MAYBE_COUNT AS ?MAYBE_COUNT #1 +
	   ?CLEFT #1
	DO CREATE _2 ?MAYBE_COUNT ,, AS #0
	DO CREATE _2 ?MAYBE_COUNT ,#61, ?CONSTANT AS ?CONSTANT #1
	DO CREATE _2 ?MAYBE_COUNT ,#61, ?EXPRESSION AS ?EXPRESSION #1
	DO CREATE _2 ?MAYBE_COUNT ,#61, ,#42, AS #65535
	DO CREATE _2 ?LEFTS ?LEFT=1 AS ?LEFT #1
	DO CREATE _2 ?LEFTS ?LEFT=1 ?LEFTS=* AS ?LEFT #1 + ?LEFTS #1

	DO CREATE _2 ?RIGHT ?EXPRESSION ?EXPRESSION AS #0 + ?EXPRESSION
	   #2 + ?EXPRESSION #1
	DO CREATE _2 ?RIGHT ?TAILS ?EXPRESSION AS #1 + ?EXPRESSION #1 +
	   ?TAILS #1
	DO CREATE _2 ?RIGHT ,#44, ,#44, AS #4 + #0
	DO CREATE _2 ?RIGHT ?BYTECODE AS #4 + !BYTECODE #1 + ?BYTECODE
	   #1
	DO CREATE _2 ?RIGHT ,#35, ?CONSTANT AS #4 + !CONSTANT #1 +
	   ?CONSTANT #1
	DO CREATE _2 ?RIGHT ,#33, ?EXPRESSION ?EXPRESSION AS #6 +
	   ?EXPRESSION #2 + ?EXPRESSION #1
	DO CREATE _2 ?RIGHT ,#33, ?SYMBOL ?EXPRESSION AS #6 +
	   ?EXPRESSION #1 + ?SYMBOL #1
	DO CREATE _2 ?RIGHT ,#42, AS #15
	DO CREATE _2 ?RIGHTS ?RIGHT=1 AS ?RIGHT #1
	DO CREATE _2 ?RIGHTS ?RIGHT=1 ,#43, ?RIGHTS=* AS ?RIGHT #1 +
	   ?RIGHTS #1

	DO CREATE _2 ?TAILS ,#44, ?E_LIST ,#44, AS MUL + !E_LIST #1 +
	   ?E_LIST #1
	DO CREATE _2 ?TAILS ,#44, ?SYMBOL ,#44, AS ?SYMBOL #1

	DO CREATE _2 ?VERB ?SPECIAL_REGISTER ,#60, ,#45, ?EXPRESSION AS
	   STO + ?EXPRESSION #1 + ?SPECIAL_REGISTER #1
	DO CREATE _2 ?VERB ,STASH, ?SPECIAL_REGISTER AS STA + #1 +
	   ?SPECIAL_REGISTER #1
	DO CREATE _2 ?VERB ,RETRIEVE, ?SPECIAL_REGISTER AS RET + #1 +
	   ?SPECIAL_REGISTER #1

	DO CREATE _2 ?VERB ,INTERNAL, ?BC_LIST AS ?BC_LIST #1

	DO CREATE _2 ?VERB ,CREATE, ?GRAMMAR ?EXPRESSION ?LEFTS ,AS,
	   ?RIGHTS AS CRE + ?GRAMMAR #1 + ?EXPRESSION #1 + !LEFTS #1 +
	   ?LEFTS #1 + !RIGHTS #1 + ?RIGHTS #1
	DO CREATE _2 ?GRAMMAR ,, AS #2
	DO CREATE _2 ?GRAMMAR ,_, ?CONSTANT AS ?CONSTANT #1

	DO CREATE _2 ?VERB ,#63, ?SYMBOL ,#60, ,#45, ,#63, ?SYMBOL AS
	   FLA + ?SYMBOL #1 + ?SYMBOL #2

	DO CREATE _2 ?VERB ,MAKE, ,NEW, ,OPCODE, ?EXPRESSION ?TAILS
	   ,AS, ?BC_LIST AS MKG + ?EXPRESSION #1 + ?TAILS #1 + !BC_LIST
	   #1 + ?BC_LIST #1

PLEASE NOTE: COMPILERS DON'T HAVE REINSTATE
	DO CREATE _2 ?VERB ,NOT, ?JUNK AS ,,
	DO CREATE _2 ?VERB ,N, ,#39, ,T, ?JUNK AS ,,

PLEASE NOTE: THE VERY LAST FEW STATEMENTS IN A COMPILER
	DO CREATE _2 ?VERB ,FREEZE, AS FRZ
	DO CREATE _2 ?VERB ,GIVE, ,UP, AS GUP

PLEASE NOTE: COMPILERS DON'T HAVE LABELS OR "%"
	DO CREATE _2 ?STATEMENT ?DO_PLEASE ?VERB AS STS + * + ?VERB #1
	DO CREATE _2 ?DO_PLEASE ,DO, AS ,,
	DO CREATE _2 ?DO_PLEASE ,PLEASE, AS ,,

PLEASE NOTE: THE WHOLE PROGRAM
	DO CREATE _2 ?PROGRAM ?STATEMENT AS ?STATEMENT #1

PLEASE NOTE: DEFINITIONS BORROWED FROM THE ASSEMBLER

PLEASE NOTE: NAMES OF "%" REGISTERS
	DO CREATE _2 ?SPECIAL_REGISTER ,#37, ?REG69=* AS ?REG69 #1
	DO CREATE _2 ?REG69 ,WT,=2 AS %WT
	DO CREATE _2 ?REG69 ,AR,=2 AS %AR
	DO CREATE _2 ?REG69 ,AW,=2 AS %AW
	DO CREATE _2 ?REG69 ,JS,=2 AS %JS
	DO CREATE _2 ?REG69 ,SS,=2 AS %SS
	DO CREATE _2 ?REG69 ,PS,=2 AS %PS
	DO CREATE _2 ?REG69 ,FS,=2 AS %FS
	DO CREATE _2 ?REG69 ,ES,=2 AS %ES
	DO CREATE _2 ?REG69 ,IS,=2 AS %IS
	DO CREATE _2 ?REG69 ,DM,=2 AS %DM
	DO CREATE _2 ?REG69 ,SP,=2 AS %SP
	DO CREATE _2 ?REG69 ,RT,=2 AS %RT
	DO CREATE _2 ?REG69 ,TH,=2 AS %TH
	DO CREATE _2 ?REG69 ,RM,=2 AS %RM
	DO CREATE _2 ?REG69 ,IO,=2 AS %IO
	DO CREATE _2 ?REG69 ,BA,=2 AS %BA
	DO CREATE _2 ?REG69 ,CF,=2 AS %CF
	DO CREATE _2 ?REG69 ,CR,=2 AS %CR
	DO CREATE _2 ?REG69 ,CW,=2 AS %CW
	DO CREATE _2 ?REG69 ,OS,=2 AS %OS
	DO CREATE _2 ?REG69 ,TM,=2 AS %TM

PLEASE NOTE: NAMES OF "@" REGISTERS
	DO CREATE _2 ?SPECIAL_REGISTER ,#64, ?REG68=* AS ?REG68 #1
	DO CREATE _2 ?REG68 ,OR,=2 AS @OR
	DO CREATE _2 ?REG68 ,OWFH,=2 AS @OWFH
	DO CREATE _2 ?REG68 ,ORFH,=2 AS @ORFH
	DO CREATE _2 ?REG68 ,OSFH,=2 AS @OSFH
	DO CREATE _2 ?REG68 ,SNFH,=2 AS @SNFH
	DO CREATE _2 ?REG68 ,TRFH,=2 AS @TRFH

PLEASE NOTE: NAMES OF "^" REGISTERS
	DO CREATE _2 ?SPECIAL_REGISTER ,#94, ?REG70=* AS ?REG70 #1
	DO CREATE _2 ?REG70 ,AV,=2 AS ^AV
	DO CREATE _2 ?REG70 ,EV,=2 AS ^EV

PLEASE NOTE: "BYTECODE" INSTRUCTION NAMES
	DO CREATE _2 ?BYTECODE ,ABG,=1 AS ABG
	DO CREATE _2 ?BYTECODE ,ABL,=1 AS ABL
	DO CREATE _2 ?BYTECODE ,AWC,=1 AS AWC
	DO CREATE _2 ?BYTECODE ,BAW,=1 AS BAW
	DO CREATE _2 ?BYTECODE ,BBT,=1 AS BBT
	DO CREATE _2 ?BYTECODE ,BSW,=1 AS BSW
	DO CREATE _2 ?BYTECODE ,BUG,=1 AS BUG
	DO CREATE _2 ?BYTECODE ,BUT,=1 AS BUT
	DO CREATE _2 ?BYTECODE ,BWC,=1 AS BWC
	DO CREATE _2 ?BYTECODE ,CFG,=1 AS CFG
	DO CREATE _2 ?BYTECODE ,CFL,=1 AS CFL
	DO CREATE _2 ?BYTECODE ,CHO,=1 AS CHO
	DO CREATE _2 ?BYTECODE ,CON,=1 AS CON
	DO CREATE _2 ?BYTECODE ,CRE,=1 AS CRE
	DO CREATE _2 ?BYTECODE ,CSE,=1 AS CSE
	DO CREATE _2 ?BYTECODE ,CWB,=1 AS CWB
	DO CREATE _2 ?BYTECODE ,DES,=1 AS DES
	DO CREATE _2 ?BYTECODE ,DOS,=1 AS DOS
	DO CREATE _2 ?BYTECODE ,DSX,=1 AS DSX
	DO CREATE _2 ?BYTECODE ,EBC,=1 AS EBC
	DO CREATE _2 ?BYTECODE ,ECB,=1 AS ECB
	DO CREATE _2 ?BYTECODE ,ENR,=1 AS ENR
	DO CREATE _2 ?BYTECODE ,ENS,=1 AS ENS
	DO CREATE _2 ?BYTECODE ,FIN,=1 AS FIN
	DO CREATE _2 ?BYTECODE ,FLA,=1 AS FLA
	DO CREATE _2 ?BYTECODE ,FOR,=1 AS FOR
	DO CREATE _2 ?BYTECODE ,FRE,=1 AS FRE
	DO CREATE _2 ?BYTECODE ,FRZ,=1 AS FRZ
	DO CREATE _2 ?BYTECODE ,GRA,=1 AS GRA
	DO CREATE _2 ?BYTECODE ,GUP,=1 AS GUP
	DO CREATE _2 ?BYTECODE ,HSN,=1 AS HSN
	DO CREATE _2 ?BYTECODE ,HYB,=1 AS HYB
	DO CREATE _2 ?BYTECODE ,IGN,=1 AS IGN
	DO CREATE _2 ?BYTECODE ,INT,=1 AS INT
	DO CREATE _2 ?BYTECODE ,LAB,=1 AS LAB
	DO CREATE _2 ?BYTECODE ,LEA,=1 AS LEA
	DO CREATE _2 ?BYTECODE ,MKG,=1 AS MKG
	DO CREATE _2 ?BYTECODE ,MSP,=1 AS MSP
	DO CREATE _2 ?BYTECODE ,MUL,=1 AS MUL
	DO CREATE _2 ?BYTECODE ,NOT,=1 AS NOT
	DO CREATE _2 ?BYTECODE ,NUM,=1 AS NUM
	DO CREATE _2 ?BYTECODE ,NXG,=1 AS NXG
	DO CREATE _2 ?BYTECODE ,NXL,=1 AS NXL
	DO CREATE _2 ?BYTECODE ,NXT,=1 AS NXT
	DO CREATE _2 ?BYTECODE ,OPT,=1 AS OPT
	DO CREATE _2 ?BYTECODE ,OSN,=1 AS OSN
	DO CREATE _2 ?BYTECODE ,OVM,=1 AS OVM
	DO CREATE _2 ?BYTECODE ,OVR,=1 AS OVR
	DO CREATE _2 ?BYTECODE ,OWN,=1 AS OWN
	DO CREATE _2 ?BYTECODE ,QUA,=1 AS QUA
	DO CREATE _2 ?BYTECODE ,REG,=1 AS REG
	DO CREATE _2 ?BYTECODE ,REL,=1 AS REL
	DO CREATE _2 ?BYTECODE ,REM,=1 AS REM
	DO CREATE _2 ?BYTECODE ,RES,=1 AS RES
	DO CREATE _2 ?BYTECODE ,RET,=1 AS RET
	DO CREATE _2 ?BYTECODE ,RIN,=1 AS RIN
	DO CREATE _2 ?BYTECODE ,ROM,=1 AS ROM
	DO CREATE _2 ?BYTECODE ,ROR,=1 AS ROR
	DO CREATE _2 ?BYTECODE ,ROU,=1 AS ROU
	DO CREATE _2 ?BYTECODE ,RSE,=1 AS RSE
	DO CREATE _2 ?BYTECODE ,SEL,=1 AS SEL
	DO CREATE _2 ?BYTECODE ,SHF,=1 AS SHF
	DO CREATE _2 ?BYTECODE ,SMU,=1 AS SMU
	DO CREATE _2 ?BYTECODE ,SPL,=1 AS SPL
	DO CREATE _2 ?BYTECODE ,SPO,=1 AS SPO
	DO CREATE _2 ?BYTECODE ,STA,=1 AS STA
	DO CREATE _2 ?BYTECODE ,STE,=1 AS STE
	DO CREATE _2 ?BYTECODE ,STO,=1 AS STO
	DO CREATE _2 ?BYTECODE ,STR,=1 AS STR
	DO CREATE _2 ?BYTECODE ,STS,=1 AS STS
	DO CREATE _2 ?BYTECODE ,STU,=1 AS STU
	DO CREATE _2 ?BYTECODE ,SUB,=1 AS SUB
	DO CREATE _2 ?BYTECODE ,SWA,=1 AS SWA
	DO CREATE _2 ?BYTECODE ,SWB,=1 AS SWB
	DO CREATE _2 ?BYTECODE ,SYS,=1 AS SYS
	DO CREATE _2 ?BYTECODE ,TAI,=1 AS TAI
	DO CREATE _2 ?BYTECODE ,TSP,=1 AS TSP
	DO CREATE _2 ?BYTECODE ,TYP,=1 AS TYP
	DO CREATE _2 ?BYTECODE ,UDV,=1 AS UDV
	DO CREATE _2 ?BYTECODE ,UNE,=1 AS UNE
	DO CREATE _2 ?BYTECODE ,UNS,=1 AS UNS
	DO CREATE _2 ?BYTECODE ,USG,=1 AS USG
	DO CREATE _2 ?BYTECODE ,WHP,=1 AS WHP
	DO CREATE _2 ?BYTECODE ,WIN,=1 AS WIN

	DO GIVE UP