% fall backs for the packages this language would like to have \providecommand*\pmb[1]{#1} % amsmath \providecommand*\relsize[1]{} % relsize \providecommand*\overset[2]{\stackrel{#1}{#2}} % amsmath \providecolor{paletteA}{HTML}{1F6FB2} \providecolor{paletteB}{HTML}{B25E1F} \providecolor{paletteC}{HTML}{6B1FB2} \providecolor{paletteD}{HTML}{1FB28A} \newcounter{lst@lambda@calculus@brackets} \begingroup\makeatletter \@for\grad:={75!white,40!black,75!white,40!black,75!white,40!black}\do{ \@for\pal:={A,B,C,D}\do{% \xglobal\colorlet{lst@lambda@calculus@brackets@\thelst@lambda@calculus@brackets}{palette\pal!\grad} \stepcounter{lst@lambda@calculus@brackets} } } \endgroup \setcounter{lst@lambda@calculus@brackets}{0} \lstdefinelanguage{lLambdaCalculus}{ add to literate={:lambda:}{{{\ensuremath{\color{xlst@colors@lst@keywordA}\pmb{\lambda}}}}}1 {\\}{{{\ensuremath{\color{xlst@colors@lst@keywordA}\pmb{\lambda}}}}}1 % we want colorized brackets {(}{{{% \textcolor{lst@lambda@calculus@brackets@\arabic{lst@lambda@calculus@brackets}}{% $\mathbf{(}_{\textsf{\relsize{-4}\the\numexpr\value{lst@lambda@calculus@brackets}+1\relax}}$% }\addtocounter{lst@lambda@calculus@brackets}{1}}}}1 {)}{{{% \addtocounter{lst@lambda@calculus@brackets}{-1}\textcolor{lst@lambda@calculus@brackets@\arabic{lst@lambda@calculus@brackets}}{% $\mathbf{)}_{\textsf{\relsize{-4}\the\numexpr\value{lst@lambda@calculus@brackets}+1\relax}}$}}}}1 {:-alpha->:}{{{\ensuremath{\overset{\alpha}{\to}}}}}2 {:-eta->:}{{{\ensuremath{\overset{\eta}{\to}}}}}2 {:-beta5->:}{{{\ensuremath{\overset{\beta_5}{\to}}}}}2 {:-beta->:}{{{\ensuremath{\overset{\beta}{\to}}}}}2, morekeywords=[4]{true,false,and,or,not,ifelse,const,head,tail,nil,null,succ,add,mult,isZero,pred}, moredelim=**[s][\itshape\color{gray}\xlstGetStyle{literals}]{[}{]}, breaklines=true % currently, listing can not literate closing braces if breaklines; see below } % Current deal with bracket close bug % \def\nocollect#1#2{} % \lst@AddToHookAtTop{SelectCharTable}{\let\lst@Def\nocollect} \RegisterLanguage[lambdacalculus,lambda_calculus]{lc}{lLambdaCalculus}