mini-go-0.3.0.0: Mini Go parser and interpreter
Safe HaskellSafe-Inferred
LanguageHaskell2010

Parser.Lexer

Description

Provides lexer parts for the Parser module.

Synopsis

Basic lexer parts

type Parser = Parsec Void Text Source #

Parser monad.

sc :: Parser () Source #

Space consumer, parses whitespace and comments.

lexeme :: Parser a -> Parser a Source #

Lexeme, automatically parses trailing whitespace and comments.

symbol :: Text -> Parser Text Source #

Symbol, automatically parses trailing whitespace and comments.

Symbols

parens :: Parser a -> Parser a Source #

Wraps given parser with parenthesis.

braces :: Parser a -> Parser a Source #

Wraps given parser with braces.

brackets :: Parser a -> Parser a Source #

Wraps given parser with brackets.

comma :: Parser Text Source #

Comma parser.

semicolon :: Parser Text Source #

Semicolon parser.

listed :: Parser a -> Parser [a] Source #

List parser.

listedInPar :: Parser a -> Parser [a] Source #

List parser.

Literals

intLitP :: Parser Integer Source #

Integer literal parser.

decimalInt :: Parser Integer Source #

Decimal integer literal parser.

binaryInt :: Parser Integer Source #

Binary integer literal parser.

octalInt :: Parser Integer Source #

Octal integer literal parser.

hexInt :: Parser Integer Source #

Hex integer literal parser.

abstractInt :: Parser a -> Parser Char -> ReadS Integer -> Parser Integer Source #

Abstract integer parser, encapsulates integer parser structure.

readInteger :: ReadS Integer -> String -> Integer Source #

Parse integer using given reader and integer string.

boolLitP :: Parser Bool Source #

Boolean literal parser.

stringLitP :: Parser Text Source #

String literal parser.

stringChar :: Parser Text Source #

String character parser.

escapedChar :: Parser Text Source #

Escaped character parser.

Identifiers and reserved

Identifier

identifierP :: Parser Identifier Source #

Custom identifier parser.

Keywords

kwVar :: Parser Text Source #

var keyword parser.

kwFunc :: Parser Text Source #

func keyword parser.

kwReturn :: Parser Text Source #

return keyword parser.

kwIf :: Parser Text Source #

if keyword parser.

kwElse :: Parser Text Source #

else keyword parser.

kwFor :: Parser Text Source #

for keyword parser.

kwBreak :: Parser Text Source #

break keyword parser.

kwContinue :: Parser Text Source #

continue keyword parser.

keywords :: [Text] Source #

Keywords.

Predeclared identifiers

idBool :: Parser Text Source #

bool identifier parser.

idInt :: Parser Text Source #

int identifier parser.

idString :: Parser Text Source #

string identifier parser.

idTrue :: Parser Text Source #

true identifier parser.

idFalse :: Parser Text Source #

false identifier parser.

idNil :: Parser Text Source #

nil identifier parser.

idLenFunc :: Parser Text Source #

len identifier parser.

idPrintFunc :: Parser Text Source #

print identifier parser.

idPrintlnFunc :: Parser Text Source #

println identifier parser.

idPanicFunc :: Parser Text Source #

panic identifier parser.

predeclaredIdentifiers :: [Identifier] Source #

Predeclared identifiers.