Skip to content

Instantly share code, notes, and snippets.

@klaeufer
Created April 3, 2012 01:15
Show Gist options
  • Save klaeufer/2288528 to your computer and use it in GitHub Desktop.
Save klaeufer/2288528 to your computer and use it in GitHub Desktop.
Lexer-only example for F# lexing and parsing example from F# Programming Wikibook
open System
open Sql
let x = "
SELECT x, y, z
FROM t1
LEFT JOIN t2
INNER JOIN t3 ON t3.ID = t2.ID
WHERE x = 50 AND y = 20
ORDER BY x ASC, y DESC, z
"
let lexbuf = Lexing.LexBuffer<_>.FromString x
while not lexbuf.IsPastEndOfStream do
printfn "%A" (SqlLexer.tokenize lexbuf)
Console.WriteLine("(press any key)")
Console.ReadKey(true) |> ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment