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/81319/golang2html/README.md | 30 ------- homework/81319/golang2html/golang2html.flex | 121 ---------------------------- homework/81319/golang2html/hello_world.go | 21 ----- 3 files changed, 172 deletions(-) delete mode 100644 homework/81319/golang2html/README.md delete mode 100644 homework/81319/golang2html/golang2html.flex delete mode 100644 homework/81319/golang2html/hello_world.go (limited to 'homework/81319/golang2html') diff --git a/homework/81319/golang2html/README.md b/homework/81319/golang2html/README.md deleted file mode 100644 index 63c5f53..0000000 --- a/homework/81319/golang2html/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# How-to guide - -## Compiling the highlighter - -1. Transpile flex file to c file -``` -flex golang2html.flex -``` - -2. Compile the produced output file - -``` -gcc lex.yy.c -o lexer -``` - -The produced output is the 'lexer' file. You use it to highlight -your own golang source files. - -## Highlighting Golang code - -1. Create your own golang source file with whatever name you wish. For -this example, let your golang source be 'hello_world.go'. - -2. Produce the highlighted html output - -``` -./lexer hello_world.go > hello_world.html -``` - -## Enjoy diff --git a/homework/81319/golang2html/golang2html.flex b/homework/81319/golang2html/golang2html.flex deleted file mode 100644 index 9501645..0000000 --- a/homework/81319/golang2html/golang2html.flex +++ /dev/null @@ -1,121 +0,0 @@ -/* golang scanner */ - -%{ -#define YY_NO_UNISTD_H -%} - -DIGIT [0-9] -ID [a-zA-Z_][a-zA-Z0-9_]* -STRQ '([^\']|(\\\'))*' -STRDQ \"([^\"]|(\\\"))*\" - -%% - -{DIGIT}+ { - printf("%s", yytext); - } - -{DIGIT}+"."{DIGIT}* { - printf("%s", yytext); - } - -break|default|func|interface|select|case|defer|go|map|struct { - printf("%s", yytext); -} - -chan|else|goto|package|switch|const|fallthrough|if|range|type|continue|for|import|return|var { - printf("%s", yytext); -} - -{ID} printf("%s", yytext); -{STRQ}|{STRDQ} printf("%s", yytext); - -"+"|"&"|"+="|"&="|"&&"|"=="|"!="|"-"|"|"|"-="|"|="|"||"|"<" { - printf("%s", yytext); -} - -"<="|"["|"]"|"*"|"^"|"*="|"^="|"<-"|">"|">="|"{"|"}"|"/"|"<<"|"/=" { - printf("%s", yytext); -} - -"<<="|"++"|"="|":="|","|";"|"%"|">>"|"%="|">>="|"--"|"!"|"..."|"."|":"|"&^"|"&^=" { - printf("%s", yytext); -} - - -[;(){}? \t\n]+ printf("%s", yytext); /* echo the rest */ - -. printf( "Unrecognized character: %s\n", yytext ); - -%% - -int yywrap() -{ - return 1; -} - -void printStyles() { - puts( - " " - ); -} - -void printHtmlHeader() { - puts( - "" - " hello_world.go" - ); - printStyles(); - puts( - "" - ); -} - -void printBody() { - puts( - "" - "
"
-      );
-      yylex();
-      puts("
"); -} - - -void printHTML() { - puts( - "" - "" - ); - printHtmlHeader(); - printBody(); - puts(""); -} - -int main(int argc, const char* argv[]) -{ - ++argv, --argc; /* skip over program name */ - if ( argc > 0 ) - yyin = fopen( argv[0], "r" ); - else - yyin = stdin; - - printHTML(); - return 0; -} diff --git a/homework/81319/golang2html/hello_world.go b/homework/81319/golang2html/hello_world.go deleted file mode 100644 index 0a31497..0000000 --- a/homework/81319/golang2html/hello_world.go +++ /dev/null @@ -1,21 +0,0 @@ -package main - -import ( - "fmt" -) - -type HelloWorlder struct { - message string -} - -func (hw *HelloWorlder) greet() { - fmt.Println(hw.message) -} - -func main() { - helloWorlder := &HelloWorlder{ - message: "Hello, world!", - } - - helloWorlder.greet() -} \ No newline at end of file -- cgit v1.3.1-26-gb76a