From aeb0d4f887a0c18c36b59acc7b5df08e62020c50 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sun, 11 Oct 2020 21:32:48 +0300 Subject: Removed old homeworks --- homework/81352/ts2html-hw2/parser.y | 86 ------------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 homework/81352/ts2html-hw2/parser.y (limited to 'homework/81352/ts2html-hw2/parser.y') diff --git a/homework/81352/ts2html-hw2/parser.y b/homework/81352/ts2html-hw2/parser.y deleted file mode 100644 index 53a56c4..0000000 --- a/homework/81352/ts2html-hw2/parser.y +++ /dev/null @@ -1,86 +0,0 @@ -%{ -#include -int yylex(); -int yyerror(const char* error); -int current_line = 1; -%} - -%code requires {#include } -%start input -%define api.value.type {std::string} - -%token KEYWORD -%token STRING -%token NUMBER -%token IDENTIFIER -%token OPERATOR -%token OTHER -%token NEWLINE -%token DECORATOR -%token COMMENT - - -%% - -input: %empty - | program { std::cout << " \ -
1. " << $1 << "
"; } - -program: expr - | program expr {$$ = $1 + $2;} - -expr: block - | nonblock - -nonblock: KEYWORD { $$ = "" + $1 + ""; } - | STRING { $$ = "" + $1 + ""; } - | NUMBER { $$ = "" + $1 + ""; } - | IDENTIFIER { $$ = "" + $1 + ""; } - | OPERATOR { $$ = "" + $1 + ""; } - | NEWLINE { $$ = $1 + "" + std::to_string(++current_line) + ". ";} - | COMMENT { $$ = "" + $1 + ""; } - | DECORATOR { $$ = "" + $1 + ""; } - | OTHER - -block: '{' program '}' {$$ = "{" + std::string("
") + $2 + "
}";} - -%% -int yyerror(const char* error) -{ - std::cerr << "error:\n" << error; - return 0; -} -int main() -{ - yyparse(); - return 0; -} -- cgit v1.3.1-26-gb76a