@setlocal @REM ------------------------------------------------------------------ ECHO You may need to configure the sample, i.e. where to find the F# compiler and C# compiler. @if "%FSHARP_HOME%"=="" ( set FSHARP_HOME=C:\fsharp) @set FSHARPLIB=%FSHARP_HOME%\lib @set FSC=%FSHARP_HOME%\bin\fsc.exe @set CSTOOLS_HOME=.. @set CSC=csc.exe @for /f %%i in ('%FSHARP_HOME%\setup\cordir') do @( @if exist %%i\csc.exe ( set CSC=%%i\csc.exe ) ) @if not exist %CSTOOLS_HOME%\lg.exe @( @echo Could not find the CS Tools at %CSTOOLS_HOME%\lg.exe. @echo You must install the CS Tools from www.gotdotnet.com @echo and set the CSTOOLS_HOME variable in the build.bat script. @exit /b 1 ) @if exist %CSTOOLS_HOME%\lg.exe ( set LG=%CSTOOLS_HOME%\lg.exe ) @if exist %CSTOOLS_HOME%\pg.exe ( set PG=%CSTOOLS_HOME%\pg.exe ) @REM ------------------------------------------------------------------ @ECHO Build the sample... %FSC% -a -g ast.ml @if ERRORLEVEL 1 exit /b %ERRORLEVEL% @ECHO Now build and compile the Lexer/Parser %LG% lang.lexer @if ERRORLEVEL 1 exit /b %ERRORLEVEL% %PG% lang.parser @if ERRORLEVEL 1 exit /b %ERRORLEVEL% %CSC% /debug+ /nologo /r:%CSTOOLS_HOME%\tools.dll /r:%FSHARP_HOME%\bin\ilxlib.dll /r:%FSHARP_HOME%\bin\fslib.dll /r:ast.dll /out:parser.dll /target:library lang.lexer.cs lang.parser.cs @if ERRORLEVEL 1 exit /b %ERRORLEVEL% @REM Now build the sample program that drives these %FSC% -g -r %CSTOOLS_HOME%\tools.dll -r parser.dll main.ml @if ERRORLEVEL 1 exit /b %ERRORLEVEL% @ECHO ------------------------------------------------------------------ @ECHO Prepare to run the sample. @ECHO We copy the CSTools Tools.dll to the local directory @ECHO rather than attempting to install it in the GAC. copy /y %CSTOOLS_HOME%\tools.dll . @for /f %%i in ('%FSHARP_HOME%\setup\cordir') do @( %%i\ngen /nologo tools.dll %%i\ngen /nologo ast.dll %%i\ngen /nologo parser.dll %%i\ngen /nologo main.exe ) @ECHO ------------------------------------------------------------------ @ECHO The sample can now be run by using: @ECHO main test.lang @endlocal @exit /b 0