!PLEASE NOTE THAT THIS PROGRAM IS A COMPILER GENERATOR
!(IACC - INTERCAL ADVANCED COMPILER COMPILER)
!
!Copyright (c) 2006-2008, 2023 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/Base aux/iacc.prefix 1.-94.-2.4"
!
!PLEASE NOTE: INITIAL VALUES FOR REGISTERS
%PS <- ?PROGRAM
%IS <- 0
%FS <- ?CALC_FULL
%ES <- ?CALC_EXPR
%JS <- ?END_JUNK
%SS <- ?SPACE
%IO <- ?CLC
%CR <- ?ASCII
%CW <- ?ASCII
?TYPE <- ?IACC
!
!PLEASE NOTE: DETERMINE WHERE JUNK ENDS
END_JUNK DO_PLEASE :
!
!PLEASE NOTE: COMPILER COMPILER STARTS HERE
BYTECODE SPECIAL_REGISTER=* : SPECIAL_REGISTER
!
BC_OR_CONST BYTECODE=* : BYTECODE
BC_OR_CONST "#" CONSTANT=1 : CONSTANT
BC_OR_CONST ":" ASM_CODE=1 : ASM_CODE
!
BC_LIST BC_OR_CONST=* : BC_OR_CONST
BC_LIST BC_OR_CONST=* "+" BC_LIST=* : BC_OR_CONST BC_LIST
!
NONBINARY "#" CONSTANT : CONSTANT
NONBINARY SPECIAL_REGISTER : SPECIAL_REGISTER
NONBINARY "," "?" E_LIST "," : "MUL" !E_LIST E_LIST
NONBINARY "?" SYMBOL : SYMBOL
NONBINARY "'" EXPRESSION "'" : EXPRESSION
NONBINARY '"' EXPRESSION '"' : EXPRESSION
EXPRESSION NONBINARY MAYBE_BINARY : MAYBE_BINARY NONBINARY
MAYBE_BINARY :
MAYBE_BINARY BINARY EXPRESSION : BINARY EXPRESSION
!
BINARY "¢" : "RIN"
BINARY "~" : "RSE"
!
E_LIST EXPRESSION=1 : EXPRESSION
E_LIST EXPRESSION=1 "+" E_LIST=* : EXPRESSION E_LIST
!
CLEFT EXPRESSION : 0 EXPRESSION
CLEFT TAILS : 1 TAILS
CLEFT "," "," : 1 "STR" 0
LEFT CLEFT MAYBE_COUNT : MAYBE_COUNT CLEFT
MAYBE_COUNT : 0
MAYBE_COUNT "=" CONSTANT : CONSTANT
MAYBE_COUNT "=" EXPRESSION : EXPRESSION
MAYBE_COUNT "=" "*" : 65535
LEFTS LEFT=1 : LEFT
LEFTS LEFT=1 LEFTS=* : LEFT LEFTS
!
RIGHT EXPRESSION EXPRESSION : 0 EXPRESSION=2 EXPRESSION=1
RIGHT TAILS EXPRESSION : 1 EXPRESSION TAILS
RIGHT "," "," : 4 0
RIGHT BYTECODE : 4 !BYTECODE BYTECODE
RIGHT "#" CONSTANT : 4 !CONSTANT CONSTANT
RIGHT ":" ASM_CODE : 4 !ASM_CODE ASM_CODE
RIGHT "!" EXPRESSION EXPRESSION : 6 EXPRESSION=2 EXPRESSION=1
RIGHT "!" SYMBOL EXPRESSION : 6 EXPRESSION SYMBOL
RIGHT "*" : 15
RIGHTS RIGHT=1 : RIGHT
RIGHTS RIGHT=1 "+" RIGHTS=* : RIGHT RIGHTS
!
TAILS "," E_LIST "," : "MUL" !E_LIST E_LIST
TAILS "," SYMBOL "," : SYMBOL
!
VERB SPECIAL_REGISTER "<" "-" EXPRESSION : "STO" EXPRESSION SPECIAL_REGISTER
VERB "STASH" SPECIAL_REGISTER : "STA" 1 SPECIAL_REGISTER
VERB "RETRIEVE" SPECIAL_REGISTER : "RET" 1 SPECIAL_REGISTER
!
VERB "INTERNAL" BC_LIST : BC_LIST
!
VERB "CREATE" GRAMMAR EXPRESSION LEFTS "AS" RIGHTS : \
	"CRE" GRAMMAR EXPRESSION !LEFTS LEFTS !RIGHTS RIGHTS
GRAMMAR : 2
GRAMMAR "_" CONSTANT : CONSTANT
!
VERB "?" SYMBOL "<" "-" "?" SYMBOL : "FLA" SYMBOL=1 SYMBOL=2
!
!PLEASE NOTE: COMPILERS DON'T HAVE REINSTATE
VERB "NOT" JUNK : "NOT"
VERB "N" "'" "T" JUNK : "NOT"
!
!PLEASE NOTE: THE VERY LAST FEW STATEMENTS IN A COMPILER
VERB "FREEZE" : "FRZ"
VERB "GIVE" "UP" : "GUP"
!
!PLEASE NOTE: COMPILERS DON'T HAVE LABELS OR "%"
STATEMENT DO_PLEASE VERB : "STS" * VERB
DO_PLEASE "DO" :
DO_PLEASE "PLEASE" :
!
!PLEASE NOTE: THE WHOLE PROGRAM
PROGRAM STATEMENT : STATEMENT
!
!PLEASE NOTE: DEFINITIONS BORROWED FROM THE ASSEMBLER
