From 5be0e39d0ce97849d7722bd1ac98563c7014faf3 Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Sun, 8 Nov 2026 11:19:44 +0300 Subject: publish --- .gitignore | 6 + README.org | 130 ++++++ UNLICENSE | 24 ++ build.sh | 14 + doc/biblio.bib | 13 + doc/gost/gost-7-32-bibliography.sty | 57 +++ doc/gost/gost-7-32-captions.sty | 23 ++ doc/gost/gost-7-32-counters.sty | 44 +++ doc/gost/gost-7-32-headings.sty | 114 ++++++ doc/gost/gost-7-32-lists.sty | 17 + doc/gost/gost-7-32-tables.sty | 29 ++ doc/gost/gost-7-32-toc.sty | 34 ++ doc/gost/gost-7-32.cls | 62 +++ doc/ox-init.el | 31 ++ doc/report.org | 763 ++++++++++++++++++++++++++++++++++++ doc/setup.org | 32 ++ doc/spbstu-report.cls | 74 ++++ lib/bnf-mode.el | 40 ++ src/bnf-lexeme.c | 10 + src/bnf-lexeme.h | 36 ++ src/bnf-lexer.c | 101 +++++ src/bnf-lexer.h | 18 + src/bnf-parser.c | 213 ++++++++++ src/bnf-parser.h | 52 +++ src/dynamic-array.h | 59 +++ src/main.c | 158 ++++++++ src/randomart-1.bnf | 10 + src/randomart-2.bnf | 10 + src/randomart-3.bnf | 10 + src/string-view.h | 17 + src/utils.h | 27 ++ 31 files changed, 2228 insertions(+) create mode 100644 .gitignore create mode 100644 README.org create mode 100644 UNLICENSE create mode 100755 build.sh create mode 100644 doc/biblio.bib create mode 100644 doc/gost/gost-7-32-bibliography.sty create mode 100644 doc/gost/gost-7-32-captions.sty create mode 100644 doc/gost/gost-7-32-counters.sty create mode 100644 doc/gost/gost-7-32-headings.sty create mode 100644 doc/gost/gost-7-32-lists.sty create mode 100644 doc/gost/gost-7-32-tables.sty create mode 100644 doc/gost/gost-7-32-toc.sty create mode 100644 doc/gost/gost-7-32.cls create mode 100644 doc/ox-init.el create mode 100644 doc/report.org create mode 100644 doc/setup.org create mode 100644 doc/spbstu-report.cls create mode 100644 lib/bnf-mode.el create mode 100644 src/bnf-lexeme.c create mode 100644 src/bnf-lexeme.h create mode 100644 src/bnf-lexer.c create mode 100644 src/bnf-lexer.h create mode 100644 src/bnf-parser.c create mode 100644 src/bnf-parser.h create mode 100644 src/dynamic-array.h create mode 100644 src/main.c create mode 100644 src/randomart-1.bnf create mode 100644 src/randomart-2.bnf create mode 100644 src/randomart-3.bnf create mode 100644 src/string-view.h create mode 100644 src/utils.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..02e5e3e --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.html +*.pdf +*.tex +*.dot +*.png +/build diff --git a/README.org b/README.org new file mode 100644 index 0000000..347a060 --- /dev/null +++ b/README.org @@ -0,0 +1,130 @@ +#+title: Grammar with semantics +#+subtitle: Random-art generation +#+date: 2025H1 + +* Overview +:PROPERTIES: +:CUSTOM_ID: overview +:END: +- Augmented a standard context-free BNF grammar with production rule + weights (probabilities) to control expression generation density and + visual aesthetics. +- Optimized and left-factorized the extended grammar to ensure + compatibility with deterministic parsing methods. +- Implemented a custom C-based lexer and recursive descent parser to + process rules, terminals, nonterminals, and probabilities. +- Engineered a stochastic expansion algorithm with depth thresholding + to synthesize complex GLSL fragment shaders driven by screen + coordinates, mouse input, and time. +- Configured distinct semantic weight profiles to generate varying + aesthetic styles (smooth vs. noise-heavy procedural patterns). +- Developed a custom GNU Emacs major mode (=bnf-mode.el=) for editing + BNF grammars. + +* Documentation +:PROPERTIES: +:CUSTOM_ID: documentation +:END: +The exported report can be found at [[https://git.michalec.dev/files/uni/term-06/math-logic/lab-05/report.pdf][this link]]. + +* Showcase +:PROPERTIES: +:CUSTOM_ID: showcase +:END: +** Example 1 +:PROPERTIES: +:CUSTOM_ID: example-1 +:UNNUMBERED: toc +:END: +*Input:* +#+begin_src bnf + ::= | 0 "-" | 10 | | 0 "abs(" ")" | "sqrt(abs(" "))" + ::= | 2 |