uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

commit 9513d81c339b37a53ec6ba33b741438ba481e23e
parent 84d3af997e9f6594d4b4e47bd60750d63a61fb97
Author: Christos Margiolis <christos@margiolis.net>
Date:   Tue, 12 Apr 2022 18:52:40 +0300

more

Diffstat:
Ac_security/ex1/Makefile | 13+++++++++++++
Dlex_bison_compilers/lex.txt | 53-----------------------------------------------------
Alex_bison_compilers/part1/02_B1_PART_A2.pdf | 0
Alex_bison_compilers/part1/cmt.fsm | 7+++++++
Alex_bison_compilers/part1/def.fsm | 7+++++++
Alex_bison_compilers/part1/float.fsm | 21+++++++++++++++++++++
Alex_bison_compilers/part1/int.fsm | 11+++++++++++
Alex_bison_compilers/part1/lex.fsm | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alex_bison_compilers/part1/sep.fsm | 7+++++++
Alex_bison_compilers/part1/str.fsm | 11+++++++++++
Alex_bison_compilers/part1/var.fsm | 8++++++++
11 files changed, 141 insertions(+), 53 deletions(-)

diff --git a/c_security/ex1/Makefile b/c_security/ex1/Makefile @@ -0,0 +1,13 @@ +TARGS = priv + +CC = cc +CFLAGS = -std=c99 -pedantic -Wall -Os -Iinclude +LIBS = -Llib -lcrypto + +all: + for targ in ${TARGS} ; do \ + ${CC} $${targ}.c ${LIBS} -o $${targ} ; \ + done + +clean: + rm -f ${TARGS} *.o *.core diff --git a/lex_bison_compilers/lex.txt b/lex_bison_compilers/lex.txt @@ -1,53 +0,0 @@ -START=SZ - -SZ: + \- -> NUM - 0 -> FLOAT_NORM - 1-9 -> INT - \? -> VAR - A-Z a-z -> DEF - ; -> CMT - \s -> SEP - " -> STR - -NUM: 0 -> FLOAT - 1-9 -> INT - * -> BAD - -INT: 0-9 -> INT - . -> FLOAT_DEC - \n -> GOOD - * -> BAD - -FLOAT_NORM: 0-9 -> FLOAT_NORM - e E -> FLOAT_EXP - . -> FLOAT_DEC - * -> BAD -FLOAT_DEC: 0-9 -> FLOAT_DEC - e E -> FLOAT_EXP - \n -> GOOD - * -> BAD -FLOAT_EXP: 0-9 + \- -> FLOAT_EXP_N - * -> BAD -FLOAT_EXP_N: 0-9 -> FLOAT_EXP_N - \n -> GOOD - * -> BAD - -STR: \\ -> STR_BSLASH - " -> GOOD - * -> STR -STR_BSLASH: " n \\ -> STR - * -> BAD - -DEF: A-Z a-z 0-9 _ \- -> DEF - * -> GOOD - -VAR: A-Z a-z 0-9 -> VAR - * -> GOOD - -CMT: \n -> GOOD - * -> CMT - -SEP: \s -> SEP - * -> GOOD - -GOOD(OK): \n -> GOOD diff --git a/lex_bison_compilers/part1/02_B1_PART_A2.pdf b/lex_bison_compilers/part1/02_B1_PART_A2.pdf Binary files differ. diff --git a/lex_bison_compilers/part1/cmt.fsm b/lex_bison_compilers/part1/cmt.fsm @@ -0,0 +1,7 @@ +START=CMT + +CMT: ; -> CMT_R + * -> BAD +CMT_R: \n -> GOOD + * -> CMT_R +GOOD(OK) : diff --git a/lex_bison_compilers/part1/def.fsm b/lex_bison_compilers/part1/def.fsm @@ -0,0 +1,7 @@ +START=DEF + +DEF: A-Z a-z -> DEF_R + * -> BAD +DEF_R: A-Z a-z 0-9 _ \- -> DEF_R + * -> GOOD +GOOD(OK): \n -> GOOD diff --git a/lex_bison_compilers/part1/float.fsm b/lex_bison_compilers/part1/float.fsm @@ -0,0 +1,21 @@ +START=FLOAT + +FLOAT: + \- -> FLOAT_BEG + 0-9 -> FLOAT_NORM + * -> BAD +FLOAT_BEG: 0-9 -> FLOAT_NORM + * -> BAD +FLOAT_NORM: 0-9 -> FLOAT_NORM + e E -> FLOAT_EXP + . -> FLOAT_DEC + * -> BAD +FLOAT_DEC: 0-9 -> FLOAT_DEC + e E -> FLOAT_EXP + \n -> GOOD + * -> BAD +FLOAT_EXP: 0-9 + \- -> FLOAT_EXP_N + * -> BAD +FLOAT_EXP_N: 0-9 -> FLOAT_EXP_N + \n -> GOOD + * -> BAD +GOOD(OK): \n -> GOOD diff --git a/lex_bison_compilers/part1/int.fsm b/lex_bison_compilers/part1/int.fsm @@ -0,0 +1,11 @@ +START=INT + +INT: + \- -> INT_BEG + 1-9 -> INT_R + * -> BAD +INT_BEG: 1-9 -> INT_R + * -> BAD +INT_R: 0-9 -> INT_R + \n -> GOOD + * -> BAD +GOOD(OK): \n -> GOOD diff --git a/lex_bison_compilers/part1/lex.fsm b/lex_bison_compilers/part1/lex.fsm @@ -0,0 +1,56 @@ +START=SZ + +SZ: + \- -> NUM + 0 -> FLOAT_NORM + 1-9 -> INT + \? -> VAR + A-Z a-z -> DEF + ; -> CMT + \s -> SEP + " -> STR + +NUM: 0 -> FLOAT_NORM + 1-9 -> INT + * -> BAD + +INT: 0-9 -> INT + . -> FLOAT_DEC + \n -> GOOD + * -> BAD + +FLOAT_NORM: 0-9 -> FLOAT_NORM + e E -> FLOAT_EXP + . -> FLOAT_DEC + * -> BAD +FLOAT_DEC: 0-9 -> FLOAT_DEC + e E -> FLOAT_EXP + \n -> GOOD + * -> BAD +FLOAT_EXP: 0-9 + \- -> FLOAT_EXP_N + * -> BAD +FLOAT_EXP_N: 0-9 -> FLOAT_EXP_N + \n -> GOOD + * -> BAD + +STR: \\ -> STR_BSLASH + " -> GOOD + * -> STR +STR_BSLASH: " n \\ -> STR + * -> BAD + +DEF: A-Z a-z 0-9 _ \- -> DEF + * -> GOOD + +VAR: A-Z a-z 0-9 -> VAR_R + * -> BAD +VAR_R: A-Z a-z 0-9 -> VAR_R + \n -> GOOD + * -> BAD + +CMT: \n -> GOOD + * -> CMT + +SEP: \s -> SEP + * -> GOOD + +GOOD(OK): \n -> GOOD diff --git a/lex_bison_compilers/part1/sep.fsm b/lex_bison_compilers/part1/sep.fsm @@ -0,0 +1,7 @@ +START=SEP + +SEP: \s -> SEP_R + * -> BAD +SEP_R: \s -> SEP_R + * -> GOOD +GOOD(OK) : diff --git a/lex_bison_compilers/part1/str.fsm b/lex_bison_compilers/part1/str.fsm @@ -0,0 +1,11 @@ +START=STR + +STR: " -> STR_R + * -> BAD +STR_R: \\ -> STR_BSLASH + " -> GOOD + * -> STR_R +STR_BSLASH: " n \\ -> STR_R + * -> BAD + +GOOD(OK): \n -> GOOD diff --git a/lex_bison_compilers/part1/var.fsm b/lex_bison_compilers/part1/var.fsm @@ -0,0 +1,8 @@ +START=VAR + +VAR: \? -> VAR_R + * -> BAD +VAR_R: A-Z a-z 0-9 -> VAR_R + \n -> GOOD + * -> BAD +GOOD(OK): \n -> GOOD