package catala

  1. Overview
  2. Docs

Concise syntax with English abbreviated keywords.

val is_code : bool ref

Boolean reference, used by the lexer as the mutable state to distinguish whether it is lexing code or law.

val code_string_acc : string ref

Mutable string reference that accumulates the string representation of the body of code being lexed. This string representation is used in the literate programming backends to faithfully capture the spacing pattern of the original program

val update_acc : Sedlexing.lexbuf -> unit

Updates code_string_acc with the current lexeme

val raise_lexer_error : Utils.Pos.t -> string -> 'a

Error-generating helper

val token_list_language_agnostic : (string * Parser.token) list

Associative list matching each punctuation string part of the Catala syntax with its Surface.Parser token. Same for all the input languages (English, French, etc.)

val token_list : (string * Parser.token) list

Same as token_list_language_agnostic, but with tokens whose string varies with the input language.

val lex_code : Sedlexing.lexbuf -> Parser.token

Main lexing function used in a code block

Main lexing function used outside code blocks

Entry point of the lexer, distributes to lex_code or lex_law depending of is_code.