From ca832cb706d6a2d49d049b0ba827f606331269c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Tue, 19 May 2009 17:20:48 +0200 Subject: define interfaces --- src/front/lexer.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/front/lexer.py (limited to 'src/front/lexer.py') diff --git a/src/front/lexer.py b/src/front/lexer.py new file mode 100644 index 0000000..aca7473 --- /dev/null +++ b/src/front/lexer.py @@ -0,0 +1,62 @@ +class Lexer: + line = 1 + + def __init__(self): + return + + def reserve(self, word): + return + + def scan(): + return + +class Tag: + # lexer tokens + NUMBER = 1 + TRUE = 2 + FALSE = 3 + IDENT = 4 + WHILE = 5 + IF = 6 + ELSE = 7 + END = 8 + LBRAK = 9 + RBRAK = 10 + LPAREN = 11 + RPAREN = 12 + NEWLINE = 13 + COMMA = 14 + FUN = 15 + ASSIGNMENT = 16 + RETURN = 17 + OPERATOR = 18 + + # parser tokens + BOOL = 19 + JOIN = 20 + EQUALITY = 21 + RELATION = 22 + EXPRESSION = 23 + TERM = 24 + UNARY = 25 + FACTOR = 26 + IDENT_LIST = 27 + EXPRESSION_LIST = 28 + PROGRAM = 29 + FUNCTION = 30 + STATEMENT = 31 + STATEMENTS = 32 + IF_STATEMENT = 33 + WHILE_STATEMENT = 34 + RETURN_STATEMENT = 35 + ASSIGN_STATEMENT = 36 + FUNCTION_CALL = 37 + +class Token: + tag = None + + def __init__(self, tag): + return + + def __str__(self): + return -- cgit v1.2.3