Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ let write (out, name, format) =
| ".ml" -> (module Cpspg.Backend.Ml.Make (Settings) (Grammar) (Automaton))
| ".mli" -> (module Cpspg.Backend.Mli.Make (Settings) (Grammar) (Automaton))
| ".dot" -> (module Cpspg.Backend.Dot.Make (Settings) (Grammar) (Automaton))
| ".fram" -> (module Cpspg.Backend.Fram.Make (Settings) (Grammar) (Automaton))
| _ ->
if format == ""
then Logger.report_err "could not determine output format for %s" name
Expand Down
26 changes: 26 additions & 0 deletions framtools/Parsing.fram
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{# Place this file in the same directory with the generated parser
or include the framtools directory via the option -L. #}

pub data Pos =
{ fname : String
, lnum : Int
, bol : Int
, cnum : Int
}

pub let dummyPos = Pos {fname = "", lnum = 0, bol = 0, cnum = 0-1}

pub data Lex E Tok =
{ token : Unit ->[E] Tok
, startPos : Unit ->[E] Pos
, curPos : Unit -> [E] Pos
}

pub data Error E = Error of ({type X} -> String ->[E] X)
pub method parseError {E} (Error f : Error E) = f

{## Error-reporting function. Use this function to report errors
in semantic actions. If an error is reported, the result
returned by the parser will be the passed string wrapped in
a `Left` constructor. ##}
pub let error {E, ~error : Error E} s = ~error.parseError s
Loading