@echo off
set COMPILER=build
for %%R in (*.cref) do echo y | refgo %COMPILER%(Lexer+Preprocessor+StdLib+runtime+StdLibEx) %%R %%~nR.ref 2>__err || goto :ON_ERROR_CREF %%R %%~nR.ref
erase __err
echo.
for %%R in (*.ref) do refc %%R 2>__err || goto :ON_ERROR_REF %%R %%~nR.rsl
erase __err
echo Y | refgo parser.rsl+build\runtime.rsl+build\StdLib.rsl+build\Lexer.rsl+build\StdLibEx.rsl test.txt result.txt 2>__err || goto :ON_ERROR_REF %%R %%~nR.rsl
goto :EOF
:ON_ERROR_CREF
echo.
echo Compilation %1-^>%2 failed with debug dump '__err'
goto :EOF
:ON_ERROR_REF
echo.
echo Compilation %1-^%2 failed:
type __err
erase __err
goto :EOF