Functional-lang  0.0
An example functional programming language
Classes | Enumerations | Functions
lexer.hpp File Reference

Lexical Analysis/Tokenizer. More...

#include "func/global.hpp"

Go to the source code of this file.

Classes

class  TokenPos
 
class  Lexer
 

Enumerations

enum  Token : int {
  tok_id = 256, tok_num, tok_int, tok_op,
  tok_eol, tok_eof, tok_obrace, tok_cbrace,
  tok_lambda, tok_atom, tok_literal, tok_if,
  tok_then, tok_else, tok_let, tok_in,
  tok_delim, tok_any, tok_err
}
 Tokens for Tokenizer/Lexical Analysis. More...
 
enum  Operator {
  op_eq, op_leq, op_geq, op_le,
  op_gt, op_land, op_lor, op_add,
  op_sub, op_mul, op_div, op_pow,
  op_asg, op_fn
}
 Operator type. More...
 

Functions

std::string std::to_string (Operator op) noexcept
 
int getOperatorPrecedence (Operator op)
 

Detailed Description

Lexical Analysis/Tokenizer.

Enumeration Type Documentation

◆ Operator

enum Operator

Operator type.

See also
Lexer::currentOperator()
Enumerator
op_eq 

==

op_leq 

<=

op_geq 

>=

op_le 

<

op_gt 

>

op_land 

&&

op_lor 

||

op_add 
op_sub 
op_mul 
op_div 

/

op_pow 

^

op_asg 

=

op_fn 

Not a real operator (functional substition)

◆ Token

enum Token : int

Tokens for Tokenizer/Lexical Analysis.

See also
Lexer::nextToken, Lexer::currentToken
Enumerator
tok_id 

Identifier.

tok_num 

Floating-point Number.

tok_int 

Integer number.

tok_op 

Binary-Operator.

tok_eol 

End of line (new-line character)

tok_eof 

End of file.

tok_obrace 

(

tok_cbrace 

)

tok_lambda 

\

tok_atom 
tok_literal 

$

tok_if 

'if'

tok_then 

'then'

tok_else 

'else'

tok_let 

'let'

tok_in 

'in'

tok_delim 

';'

tok_any 

'_'

tok_err 

Error.

Function Documentation

◆ getOperatorPrecedence()

int getOperatorPrecedence ( Operator  op)
Returns
Returns operator precedence of binary operator op