Skip to content

Instantly share code, notes, and snippets.

@klaeufer
Created April 2, 2012 17:57
Show Gist options
  • Save klaeufer/2285720 to your computer and use it in GitHub Desktop.
Save klaeufer/2285720 to your computer and use it in GitHub Desktop.
Makefile for F# lexing and parsing example from F# Programming Wikibook
# Makefile for F# lexing and parsing example from
# http://en.wikibooks.org/wiki/F_Sharp_Programming/Lexing_and_Parsing
# Sources available at https://github.com/obeleh/FsYacc-Example
#
# http://laufer.cs.luc.edu/teaching/372
#
# Prerequisites
# make
# http://fsharppowerpack.codeplex.com/ for fslex, fsyacc
# http://fsxplat.codeplex.com/ for fsharpc (and fsharpi)
#
# Instructions
# git clone https://github.com/obeleh/FsYacc-Example.git
# cd YaccSample
# download this gist as Makefile
# make
FSPPHOME=/opt/FSharpPowerPack-2.0.0.0
# change to .1 if you manually installed F# for .NET 4.0
FSC=fsharpc
all: Program.exe
SqlLexer.fs: SqlLexer.fsl
mono $(FSPPHOME)/bin/fslex.exe SqlLexer.fsl --unicode
SqlParser.fs: SqlParser.fsp
mono $(FSPPHOME)/bin/fsyacc.exe SqlParser.fsp --module SqlParser
SqlParser.fsi: SqlParser.fsp
SOURCES=Sql.fs SqlParser.fsi SqlParser.fs SqlLexer.fs
Program.exe: $(SOURCES) Program.fs
$(FSC) --reference:$(FSPPHOME)/bin/FSharp.PowerPack.dll $(SOURCES) Program.fs
LexerOnly.exe: $(SOURCES) LexerOnly.fs
$(FSC) --reference:$(FSPPHOME)/bin/FSharp.PowerPack.dll $(SOURCES) LexerOnly.fs
clean:
rm -f Program.exe SqlParser.fsi SqlParser.fs SqlLexer.fs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment