This document discusses parsing F# code with PetitParser. It focuses on indentation-sensitive features of F#, including the off-side rule where code must be indented at the same level or further than the previous line. The document presents some F# code examples and discusses challenges in building a PetitParser grammar to parse the F# syntax.
1 of 17
Download to read offline
More Related Content
2015.01.06 f sharp_intro_milan_kubicek
1. Parsing F# with PetitParser
F# indentation sensitive
lightweight syntax
?
?
Milan Kubicek ?
SCG Seminar ?
06.01.2015
16. ¨C http://en.wikipedia.org/wiki/Secondary_notation 05.01.2015
¡°¡An example of secondary notation is in
computer programming, where code is often
displayed with positioning, indentation, color
and symmetry. This does not affect the
behaviour of the program, but it makes it easier
to read and understand the code¡¡±
16
secondary notation
17. ¨CPeter J. Landin, ¡°The Next 700 Programming Languages¡±
¡°Any non-whitespace token to the left of the first
such token on the previous line is taken to be
the start of a new declaration.¡±
Off-side rule
17