diff options
Diffstat (limited to '2023/captions')
2 files changed, 1734 insertions, 1436 deletions
diff --git a/2023/captions/emacsconf-2023-eat--eat-and-eat-powered-eshell-fast-featureful-terminal-inside-emacs--akib-azmain-turja--main.vtt b/2023/captions/emacsconf-2023-eat--eat-and-eat-powered-eshell-fast-featureful-terminal-inside-emacs--akib-azmain-turja--main.vtt new file mode 100644 index 00000000..ccc2126f --- /dev/null +++ b/2023/captions/emacsconf-2023-eat--eat-and-eat-powered-eshell-fast-featureful-terminal-inside-emacs--akib-azmain-turja--main.vtt @@ -0,0 +1,244 @@ +WEBVTT captioned by sachac + +NOTE Intro + +00:00:00.000 --> 00:00:04.199 +Hello everyone. Welcome to my talk. + +00:00:04.200 --> 00:00:09.359 +I am Akib Azmain Turja and my talk is titled + +00:00:09.360 --> 00:00:11.519 +"Eat and Eat-powered Eshell: + +00:00:11.520 --> 00:00:15.439 +Fast, featureful terminal inside Emacs." + +NOTE Benchmarking + +00:00:15.440 --> 00:00:22.839 +So I just claimed that Eat is a fast terminal emulator. + +00:00:22.840 --> 00:00:33.279 +Let me show you that. I will print a 1-megabyte sized file + +00:00:33.280 --> 00:00:39.039 +in the terminal using this command. + +00:00:39.040 --> 00:00:47.359 +It takes 0.76 seconds. Now let's benchmark term-mode. + +00:00:47.360 --> 00:00:54.799 +I will be in term -mode. I use the same command, + +00:00:54.800 --> 00:01:06.599 +and it's clearly the loser. + +00:01:06.600 --> 00:01:18.319 +It took 12 seconds, more than an order of magnitude slower. + +00:01:18.320 --> 00:01:27.279 +Let's also measure the speed of return. + +00:01:27.280 --> 00:01:33.479 +And it took 0.79 seconds. + +00:01:33.480 --> 00:01:36.159 +But this is actually a little bit slower than Eat. + +00:01:36.160 --> 00:01:41.799 +Why? That shouldn't happen. + +00:01:41.800 --> 00:01:49.719 +Anyway, hopefully that shows how fast Eat is. + +NOTE Running programs + +00:01:49.720 --> 00:01:54.439 +So let's run some extra programs in Eat, + +00:01:54.440 --> 00:02:05.639 +like top. You can also run htop or even btop. + +00:02:05.640 --> 00:02:08.559 +There is a fancy version of top. + +00:02:08.560 --> 00:02:20.239 +And obviously you can run Emacs in it. + +00:02:20.240 --> 00:02:33.879 +There is mouse support, and there is true color support. + +00:02:33.880 --> 00:02:38.799 +You can show any color in the terminal + +00:02:38.800 --> 00:02:47.079 +as long as your main display supports it. + +NOTE Shell integration + +00:02:47.080 --> 00:02:50.359 +And then there is shell integration. + +00:02:50.360 --> 00:02:52.399 +For example, directory tracking. + +00:02:52.400 --> 00:03:07.479 +Like, I can switch to some other directory + +00:03:07.480 --> 00:03:11.919 +and Emacs follows the shell directory. + +NOTE Prompt annotation + +00:03:11.920 --> 00:03:16.439 +Then there is prompt annotation, + +00:03:16.440 --> 00:03:20.319 +this column. These zeros indicate + +00:03:20.320 --> 00:03:27.079 +that the command has executed successfully. + +00:03:27.080 --> 00:03:37.679 +Then you can navigate between commands like this. + +NOTE Message passing + +00:03:37.680 --> 00:03:39.399 +There is message passing. + +00:03:39.400 --> 00:03:44.119 +By message passing, I mean sending something + +00:03:44.120 --> 00:03:46.959 +from the terminal to the host Emacs. + +00:03:46.960 --> 00:03:52.119 +By host Emacs, I mean Emacs running the terminal. + +00:03:52.120 --> 00:03:57.439 +For example I can say "hi" and it's showing "hi" + +00:03:57.440 --> 00:04:03.519 +in this echo area of my Emacs. + +NOTE Shell integration + +00:04:03.520 --> 00:04:08.679 +Then let's show you the killer feature of Eat, + +00:04:08.680 --> 00:04:20.239 +Eat's shell integration. + +00:04:20.240 --> 00:04:37.839 +You can run any program in it. For example: top, btop, + +00:04:37.840 --> 00:04:52.159 +and obviously Emacs itself. + +NOTE Input modes + +00:04:52.160 --> 00:05:03.159 +So let's discuss how to use Eat. There are four input modes. + +00:05:03.160 --> 00:05:07.319 +The first one is semi-char mode. That is the default mode. + +00:05:07.320 --> 00:05:10.919 +This is like vterm. All keys are the same to your terminal + +00:05:10.920 --> 00:05:17.879 +except these keys: C-c, C-x, C-g, M-x, etc. + +00:05:17.880 --> 00:05:20.599 +And then there is char-mode, where all keys + +00:05:20.600 --> 00:05:26.919 +are same to your terminal, except this M-RET key + +00:05:26.920 --> 00:05:29.679 +which takes you back to the semi-char mode. + +00:05:29.680 --> 00:05:34.559 +Then there is Emacs mode where you can select + +00:05:34.560 --> 00:05:39.719 +and copy from the terminal buffer. + +00:05:39.720 --> 00:05:42.679 +And finally, there is line mode. + +00:05:42.680 --> 00:05:49.199 +You can use it to use your terminal like a comint buffer. + +00:05:49.200 --> 00:05:55.999 +All these input modes are available in both Eat + +00:05:56.000 --> 00:06:05.879 +and eat-eshell mode, except this line mode-- + +00:06:05.880 --> 00:06:10.439 +it's only available on Eat. + +00:06:10.440 --> 00:06:13.959 +By "on Eat", I mean the terminal you get + +00:06:13.960 --> 00:06:20.159 +by this eat command. By eshell, I mean + +00:06:20.160 --> 00:06:23.144 +when eat-eshell integration is enabled + +00:06:23.145 --> 00:06:28.446 +inside the eshell buffer. + +NOTE Documentation + +00:06:33.760 --> 00:06:36.719 +There is an info manual, + +00:06:36.720 --> 00:06:51.599 +And also the README is quite informative + +00:06:51.600 --> 00:06:54.999 +for you to get started. + +00:06:55.000 --> 00:07:13.519 +If you hit any problem, + +00:07:13.520 --> 00:07:22.959 +there is a dedicated chapter for debugging that, + +00:07:22.960 --> 00:07:26.119 +a common problems chapter. + +00:07:26.120 --> 00:07:27.999 +If your problem is still not fixed, + +00:07:28.000 --> 00:07:29.519 +please report it to me. + +00:07:29.520 --> 00:07:36.119 +This helps me improve it for everyone. + +00:07:36.120 --> 00:07:40.359 +When you report, please read this chapter + +00:07:40.360 --> 00:07:53.159 +so that you can make a better bug report. + +00:07:53.160 --> 00:07:57.639 +I am really looking forward to how people use it + +00:07:57.640 --> 00:07:59.079 +in their workflow. + +00:07:59.080 --> 00:08:03.479 +I am excited about that. + +00:08:03.480 --> 00:08:10.759 +Hopefully you enjoyed my talk. That was all. + +00:08:10.760 --> 00:08:12.720 +Enjoy EmacsConf. Goodbye. diff --git a/2023/captions/emacsconf-2023-repl--repls-in-strange-places-lua-latex-lpeg-lpegrex-tikz--eduardo-ochs--main.vtt b/2023/captions/emacsconf-2023-repl--repls-in-strange-places-lua-latex-lpeg-lpegrex-tikz--eduardo-ochs--main.vtt index 3bd5b01b..600d07b5 100644 --- a/2023/captions/emacsconf-2023-repl--repls-in-strange-places-lua-latex-lpeg-lpegrex-tikz--eduardo-ochs--main.vtt +++ b/2023/captions/emacsconf-2023-repl--repls-in-strange-places-lua-latex-lpeg-lpegrex-tikz--eduardo-ochs--main.vtt @@ -1,2219 +1,2273 @@ -WEBVTT +WEBVTT captioned by sachac -00:00.000 --> 00:04.880 -Hi, my name is Eduard Duax, and the title of this talk is +NOTE Intro -00:04.880 --> 00:09.680 -Rapples in Strange Places, Lua, LaTeX, LPEG, LPEG-REX, and TIX. +00:00.000 --> 00:00:00.014 +Hi, my name is Eduardo Ochs -00:10.720 --> 00:17.200 -I'm the author of an MX package called EEV, and this is a talk at the MXConf 2023 +00:00:00.015 --> 00:00:05.020 +and the title of this talk is -00:17.200 --> 00:20.880 -that is happening in December 2023 at the Internets. +00:05.020 --> 00:07.840 +REPLs in Strange Places: Lua, LaTeX, -00:21.680 --> 00:25.920 -And this is one of the examples of diagrams that we are going to see. +00:07.840 --> 00:10.440 +LPeg, LPegRex, and TikZ. -00:25.920 --> 00:27.680 -Let me show how I generate it. +00:10.440 --> 00:13.400 +I'm the author of an Emacs package called eev, -00:28.640 --> 00:32.240 -One second. I have to use a smaller font here. +00:13.400 --> 00:17.280 +and this is a talk at the EmacsConf 2023, -00:35.600 --> 00:41.920 -This is a file called parse32.lua. Let me go back to this block of tests again. +00:17.280 --> 00:21.560 +that is happening in December 2023 at the Internet. -00:42.720 --> 00:50.320 -And now if I run this, we get these outputs here at the right. +NOTE Diagrams -00:52.000 --> 00:54.960 -And then in this line here, it generates a PDF. +00:21.560 --> 00:00:24.243 +This is one of the examples of diagrams -00:55.520 --> 01:01.440 -And if I type f8 here, it shows the PDF in the lower right window. +00:00:24.244 --> 00:00:25.920 +that we are going to see. -01:04.240 --> 01:07.600 -Let me start by explaining briefly what is EEV. +00:25.920 --> 00:28.400 +Let me show how I generated it. -01:09.920 --> 01:14.560 -First, it's something that appeared by accident in the mid-90s. +00:28.400 --> 00:33.600 +One second, I have to use a smaller font here. -01:14.560 --> 01:19.920 -I explained this story in my presentation at the MXConf 2019. +00:34.560 --> 00:39.080 +This is a file called parse32.lua. -01:20.720 --> 01:25.520 -It's a package. It's an MX package that is part of ELPA. +00:39.080 --> 00:42.600 +Let me go back to this block of tests again. -01:25.520 --> 01:31.440 -It has at least 10 users. Those are the ones that I know by name. +00:42.600 --> 00:45.520 +Now, if I run this, -01:33.360 --> 01:36.320 -EEV means MX Execute Verbosely. +00:46.720 --> 00:51.520 +we get these outputs here at the right. -01:37.360 --> 01:42.640 -EEV is something that treats eval as the central feature of MX. +00:51.520 --> 00:53.800 +Then in this line here, -01:43.680 --> 01:46.800 -EEV blurs the distinction between programmers and users, +00:53.800 --> 00:55.420 +it generates a PDF, -01:47.520 --> 01:50.080 +00:55.420 --> 00:57.780 +and if I type `F8` here, + +00:57.780 --> 01:02.560 +it shows the PDF in the lower right window. + +NOTE eev + +01:03.320 --> 01:08.920 +Let me start by explaining briefly what is eev. + +01:08.920 --> 00:01:10.889 +First, it's something + +00:01:10.890 --> 00:01:14.560 +that appeared by accident in the mid 90s. + +01:14.560 --> 01:20.640 +I explained this story in my presentation at EmacsConf 2019. + +01:20.640 --> 01:25.420 +It's an Emacs package that is part of ELPA. + +01:25.420 --> 01:28.720 +It has at least 10 users. + +01:28.720 --> 01:32.480 +Those are the ones that I know by name. + +01:32.480 --> 01:36.960 +eev means "Emacs, execute verbosely". + +01:36.960 --> 00:01:38.847 +eev is something that treats eval-last-sexp + +00:01:38.848 --> 00:01:43.400 +as the central feature of Emacs. + +01:43.400 --> 01:47.280 +eev blurs the distinction between programmers and users, + +01:47.280 --> 01:49.960 and it replaces the slogan, -01:50.080 --> 01:55.360 -users should not be forced to see Lisp, that is something that Richard Stallman told me once, +01:49.960 --> 01:52.360 +"users should not be forced to see Lisp" -01:55.360 --> 01:59.280 -by users should see Lisp instead of buttons, +01:52.360 --> 01:55.280 +(that is something that Richard Stallman told me once), -01:59.280 --> 02:02.400 -and new users should see Lisp in the first five minutes. +01:55.280 --> 01:59.240 +by "users should see Lisp instead of buttons," -02:04.240 --> 02:07.120 +01:59.240 --> 02:03.400 +and "new users should see Lisp in the first five minutes." + +02:03.400 --> 02:08.160 I'm going to show some examples of that soon. -02:08.800 --> 02:12.880 -EEV uses code in comments a lot, and also tests in comments. +02:08.160 --> 00:02:11.565 +eev uses code in the comments a lot + +00:02:11.566 --> 00:02:14.120 +and also tests in comments. -02:13.600 --> 02:21.040 -I changed my way of presenting it, and it became very REPL-centric in the last few years, +02:14.120 --> 00:02:16.781 +I changed my way of presenting it, -02:21.040 --> 02:28.240 -in the sense that I start by explaining its main features by its support for REPLs. +00:02:16.782 --> 00:02:19.190 +and it became very REPL-centric -02:30.320 --> 02:34.320 -EEV supposes that we want to keep executable notes of everything. +00:02:19.191 --> 00:02:22.200 +in the last few years, in the sense that -02:34.320 --> 02:37.040 +02:22.200 --> 00:02:26.460 +I start by explaining its main features + +00:02:26.461 --> 00:02:29.520 +by its support for REPLs. + +02:29.520 --> 00:02:32.078 +eev supposes that we want to keep + +00:02:32.079 --> 00:02:34.560 +executable notes of everything. + +02:34.560 --> 02:37.800 I'm also going to show examples of this in a second. -02:38.080 --> 02:41.600 -EEV has lots of videos for people who hate videos, +02:37.800 --> 02:42.120 +eev has lots of videos for people who hate videos, -02:42.240 --> 02:47.520 -and it tries to do everything with very little magic and without black boxes. +02:42.120 --> 00:02:44.270 +and it tries to do everything -02:47.520 --> 02:50.240 +00:02:44.271 --> 00:02:47.640 +with very little magic and without black boxes. + +02:47.640 --> 02:51.360 I'm going to explain many of these things very soon. -02:52.880 --> 02:58.160 -This is a figure that I'm going to show in detail soon, +NOTE Another figure + +02:51.360 --> 02:58.200 +This is a figure that I'm going to show in detail soon -02:58.160 --> 03:01.520 +02:58.200 --> 03:01.640 that is about something important about Lua. -03:01.520 --> 03:05.280 -Oops, the font is very bad now, so let me change the font. +03:01.640 --> 03:03.400 +Oops, the font is very bad now, + +03:03.400 --> 03:05.200 +so let me change the font. + +03:05.200 --> 03:07.760 +The figure is this one. -03:05.280 --> 03:07.840 -The figure is this one, and +03:09.880 --> 00:03:12.935 +What most people do when they visit a file -03:08.560 --> 03:13.440 -what most people do when they visit a file with something interesting on it +00:03:12.936 --> 00:03:15.280 +with something interesting in it, -03:13.440 --> 03:16.640 -is that they just go there, and they set a bookmark there, +03:15.280 --> 03:18.360 +is that they just go there and they set a bookmark there, -03:16.640 --> 03:19.760 +03:18.360 --> 03:22.640 or they put the position in the register. -03:21.760 --> 03:28.480 -But I prefer to keep links to everything that is interesting as a list of hyperlinks. +03:22.640 --> 00:03:29.781 +But I prefer to keep links -03:28.480 --> 03:32.640 -So, for example, this is an at least hyperlink to the file +00:03:29.782 --> 00:03:30.221 +to everything that is interesting -03:32.640 --> 03:36.480 -that goes to this anchor here, and to this string I've added. +00:03:30.222 --> 00:03:30.480 +as an Elisp hyperlink. -03:36.480 --> 03:38.560 -And to this string after this anchor. +03:30.480 --> 00:03:34.236 +For example, this is an Elisp hyperlink to the file -03:39.760 --> 03:45.760 -This is a variant that opens that file in the window at the right here. +00:03:34.237 --> 00:03:36.520 +that goes to this anchor here, -03:47.440 --> 03:53.520 -And this is a sexpid that changes the font. +03:36.520 --> 03:39.280 +and to this string after this anchor. -03:53.520 --> 03:57.680 +03:39.280 --> 00:03:43.388 +This is a variant that opens that file + +00:03:43.389 --> 00:03:46.760 +in the window at the right here, + +03:46.760 --> 03:53.640 +and this is a sexp that changes the font. + +03:53.640 --> 03:57.880 I have a command with a very short name that does that, -03:58.400 --> 04:02.880 +03:57.880 --> 04:03.680 but I prefer to keep that as a one-liner. -04:03.840 --> 04:11.440 -About the videos, we can see the list of first-class videos of Eevee by executing this, +04:03.680 --> 00:04:04.281 +About the videos, we can see + +00:04:04.282 --> 00:04:11.440 +the list of first-class videos of eev by executing this, -04:11.440 --> 04:16.960 -meta-x, find first-class videos, or by running this alias here, +04:11.440 --> 00:04:14.190 +`M-x find-1stclassvideos`, -04:16.960 --> 04:20.320 -meta-x1c, and then what we see is this. +00:04:14.191 --> 00:04:18.480 +or by running this alias here, `M-x 1c`, -04:21.520 --> 04:25.440 -The first sexpid here regenerates this buffer, +04:18.480 --> 04:21.160 +and then what we see is this. -04:25.440 --> 04:28.960 +04:21.160 --> 04:25.560 +The first sexp here regenerates this buffer, + +04:25.560 --> 04:29.120 so we can make a mess here and then run this, -04:29.040 --> 04:33.040 +04:29.120 --> 04:34.120 and the original buffer is regenerated again in a clean way. -04:34.880 --> 04:42.000 -Each of these things here opens a buffer with information about a video. +04:34.120 --> 00:04:36.951 +Each of these things here + +00:04:36.952 --> 00:04:41.960 +opens a buffer with information about a video. -04:42.000 --> 04:44.400 +04:41.960 --> 04:45.320 Let me take a specific example here. -04:46.080 --> 04:50.720 -This video here is about one of the ancestors of this talk, +04:45.320 --> 00:04:50.278 +This video here is about one of the ancestors of this talk -04:50.720 --> 04:52.960 -that is a library that I wrote for +00:04:50.279 --> 00:04:52.800 +that is a library that I wrote -04:53.920 --> 05:01.120 -creating diagrams in LaTeX using a package called pic2e, using repls. +04:52.800 --> 00:04:56.906 +for creating diagrams in LaTeX -05:02.320 --> 05:10.720 -Anyway, the thing is that if we run a sexpid like this one, +00:04:56.907 --> 00:05:03.000 +using a package called [pict2e-lua] using REPLs. -05:10.720 --> 05:13.440 -and we don't have a local copy of the video, +05:03.000 --> 00:05:10.028 +Anyway, the thing is that if we run a sexp like this one -05:14.080 --> 05:16.320 -Eevee will try to load the local copy, +00:05:10.029 --> 00:05:16.314 +and we don't have a local copy of the video, -05:16.320 --> 05:19.600 -and instead of doing that and by asking something like, +00:05:16.315 --> 00:05:19.581 +eev will try to load the local copy -05:19.680 --> 05:20.720 -asking something like, +00:05:19.582 --> 00:05:20.560 +and instead of doing that by asking something -05:20.720 --> 05:24.560 -do you want me to download the local copy, blah, blah, blah, blah, +05:20.560 --> 00:05:25.381 +like "do you want me to download the local copy" -05:25.680 --> 05:28.720 -it simply opens a buffer like this. +00:05:25.382 --> 00:05:29.240 +blah, blah, blah, it simply opens a buffer like this. -05:28.720 --> 05:32.480 -I mean, if we don't have a local copy yet, +05:29.240 --> 00:05:35.514 +And if we don't have a local copy yet, -05:32.480 --> 05:34.400 +00:05:35.515 --> 00:05:37.220 it will open a buffer like this one, -05:35.440 --> 05:41.760 -in which these things here in comments are links to the documentation. +00:05:37.221 --> 00:05:40.030 +in which these things here in comments -05:41.760 --> 05:48.240 -I mean, this thing here explains the idea of local copies of files from the internet, +00:05:40.031 --> 00:05:42.678 +are links to the documentation. -05:48.880 --> 05:52.960 -uh, there are more details here and here, +00:05:42.679 --> 00:05:45.780 +This thing here explains the idea -05:53.840 --> 05:59.280 +00:05:45.781 --> 00:05:50.278 +of local copies of files from the internet. + +00:05:50.279 --> 00:05:54.120 +There are more details here and here, + +00:05:54.121 --> 00:05:59.580 and this is a script that we can execute line by line. -05:59.280 --> 06:04.080 -So, instead of this script being hidden behind the button that we just +05:59.580 --> 00:06:04.276 +So instead of this script being hidden behind the button + +00:06:04.277 --> 00:06:07.160 +that we just press after a question + +06:07.160 --> 00:06:10.708 +like "do you want me to do something," blah, blah, blah, + +00:06:10.709 --> 00:06:13.228 +"yes or no?", the script is visible here + +00:06:13.229 --> 00:06:15.380 +and we can execute it step by step. + +06:15.380 --> 00:06:22.457 +It creates a terminal with a shell here in the right window + +00:06:22.458 --> 00:06:26.988 +and when we type `F8` in these lines here, -06:04.960 --> 06:07.360 -press after a question like, +00:06:26.989 --> 00:06:30.360 +the lines are sent to this line. -06:07.360 --> 06:09.920 -do you want me to do something, blah, blah, blah, yes or no, +06:30.360 --> 00:06:33.842 +So this is going to download a copy of the video, -06:11.200 --> 06:15.120 -the script is visible here, and we can execute it step by step. +00:06:33.843 --> 00:06:38.134 +the wget says that I already have a copy of the video -06:15.200 --> 06:22.080 -It creates a terminal with a shell here in the right window, +00:06:38.135 --> 00:06:40.360 +and its subtitles and so on. -06:22.080 --> 06:28.880 -and when we type f8 in these lines here, the lines are sent to this line. +06:40.360 --> 00:06:45.739 +And after getting a copy of the video -06:30.080 --> 06:33.920 -So, this is going to download the copy of the video, +00:06:45.740 --> 00:06:52.960 +we can run this exp here and it displays the video. -06:33.920 --> 06:39.360 -the wget says that I already have a copy of the video in its subtitles, and so on. +06:52.960 --> 00:06:55.486 +I said that eev has lots of videos -06:39.920 --> 06:47.600 -And after getting a copy of the video, we can run this exp here, and it displays the video. +00:06:55.487 --> 00:06:57.435 +for people who hate videos. -06:52.880 --> 06:57.840 -I said that Eevee has lots of videos for people who hate videos, +00:06:57.436 --> 00:07:00.046 +The idea is that very few people -06:57.840 --> 07:02.960 -and the idea is that very few people are going to watch the videos in real time, +00:07:00.047 --> 00:07:03.081 +are going to watch the videos in real time. -07:03.920 --> 07:10.480 -and most of the people that I know, or most of the people that are interested in Eevee in some way, +00:07:03.082 --> 00:07:07.642 +Most of the people that I know, or most of the people -07:10.480 --> 07:15.280 -they are going to watch just small sections of the video, +00:07:07.643 --> 00:07:10.790 +that are interested in eev in some way, -07:15.280 --> 07:18.720 -and most of the time they're just going to read the subtitles of the video. +00:07:10.791 --> 00:07:14.320 +they are going to watch just small sections of the video. -07:19.680 --> 07:25.760 -So, for each one of the videos, we have a page about the video. +00:07:14.321 --> 00:07:17.574 +Most of the time, they are just going to -07:25.760 --> 07:28.400 -Let me see if I have internet here. +00:07:17.575 --> 00:07:19.940 +read the subtitles of the video. -07:28.400 --> 07:29.680 -Yes, this is a page, +07:19.940 --> 00:07:22.531 +For each one of the videos -07:29.920 --> 07:36.080 -and usually these pages have a link to another page, +00:07:22.532 --> 00:07:25.295 +we have a page about the video... -07:36.080 --> 07:42.880 -the page that has all the subtitles of the video, wherever. +00:07:25.296 --> 00:07:29.673 +Let me see if I have internet here... -07:42.880 --> 07:46.960 -In this one, it's not so visible, but anyway, +00:07:29.674 --> 00:07:34.901 +This is a page. Usually these pages -07:46.960 --> 07:50.480 -there are several ways of accessing the subtitles of the video, +00:07:34.902 --> 00:07:38.427 +have a link to another page, -07:50.480 --> 07:54.720 -and one of the ways is by running this exp here, +00:07:38.428 --> 00:07:43.890 +the page that has all the subtitles of the video, -07:55.040 --> 07:57.280 -is by running this exp here, +00:07:43.891 --> 00:07:48.587 +wherever. In this one, it's not so visible. -07:59.440 --> 08:03.680 -that opens a file in Lua that is what I use to generate the subtitles. +00:07:48.588 --> 00:07:52.001 +Anyway, there are several ways of accessing -08:04.880 --> 08:13.760 -Anyway, by the way, each one of these things here is hyperlinked to a position of the video, +00:07:52.002 --> 00:07:53.963 +the subtitles of the video. -08:14.400 --> 08:19.280 -so if I type this in the right way, it goes to that position. +00:07:53.964 --> 00:07:58.632 +One of the ways is by running this sexp here -08:20.160 --> 08:21.280 +00:07:58.633 --> 00:08:01.064 +that opens a file in Lua. + +00:08:01.065 --> 00:08:05.440 +That is what I use to generate the subtitles. + +08:05.440 --> 00:08:10.368 +By the way, each one of these things here + +00:08:10.369 --> 00:08:14.680 +is hyperlinked to a position of the video. + +08:14.680 --> 00:08:21.280 +If I type this, it goes to that position. + +00:08:21.281 --> 00:08:24.580 Anyway, let me go back. -08:21.920 --> 08:26.640 -Also, the tutorials of Eevee, the intros of Eevee, +08:24.580 --> 00:08:28.557 +So the tutorials of eev, the intros of eev + +00:08:28.558 --> 00:08:32.350 +that start with `find-` and end with `-intro`, + +00:08:32.351 --> 00:08:35.332 +they have lots of blocks that say + +00:08:35.333 --> 00:08:37.612 +video links like this one. -08:26.640 --> 08:30.560 -let's start with find, and with intro, +00:08:37.613 --> 00:08:41.972 +These blocks have links to positions in videos. -08:30.560 --> 08:35.760 -they have lots of blocks that say video links, like this one, +00:08:41.973 --> 00:08:46.332 +If we don't have a local copy of the video yet, -08:36.800 --> 08:40.080 -and these blocks have links to the positions in videos, +00:08:46.333 --> 00:08:49.015 +the thing shows us a script -08:40.080 --> 08:43.600 -and if we don't have a local copy of the video yet, +00:08:49.016 --> 00:08:52.560 +that lets us download the local copy. -08:44.480 --> 08:48.800 -the thing shows us a script that lets us download the local copy. +NOTE eev-wconfig, magic, and black boxes -08:48.880 --> 08:56.720 -Anyway, I said that I was going to explain what I mean by magic and black boxes. +08:52.560 --> 00:08:57.440 +I said that I was going to explain -08:59.360 --> 09:02.080 -This is something that I've been trying to explain for a long time, +00:08:57.441 --> 00:09:01.855 +what I mean by magic and black boxes, -09:02.080 --> 09:05.840 +00:09:01.856 --> 00:09:03.799 +this is something that I've been trying + +00:09:03.800 --> 00:09:05.111 +to explain for a long time + +00:09:05.112 --> 00:09:08.761 and I think that I got a very good explanation about that -09:05.840 --> 09:09.440 -in a video that I made about something called Eevee wconfig, +00:09:08.762 --> 00:09:12.348 +in a video that I made about something called eev-wconfig -09:09.440 --> 09:15.120 -that is a tool for configuring Eevee on Windows without magic, +00:09:12.349 --> 00:09:17.943 +that is a tool for configuring eev on Windows without magic, -09:15.840 --> 09:20.320 -on Windows without magic, without buttons that do things +00:09:17.944 --> 00:09:20.878 +without buttons that do things, -09:21.040 --> 09:22.720 +00:09:20.879 --> 00:09:24.380 without explaining what they are doing. -09:24.080 --> 09:26.720 +09:24.380 --> 00:09:28.078 This is a part of the subtitles of the video. -09:26.720 --> 09:27.680 +00:09:28.079 --> 00:09:29.445 Let me read that. -09:30.080 --> 09:32.640 -Eevee wconfig is an attempt to solve the problem +00:09:29.446 --> 00:09:32.531 +eev-wconfig is an attempt to solve the problem -09:32.640 --> 09:35.040 -of how to install these things on Windows, +00:09:32.532 --> 00:09:35.349 +of how to install these things on Windows -09:35.040 --> 09:38.240 +00:09:35.350 --> 00:09:40.040 both without magic and with very little magic. -09:39.520 --> 09:40.640 -Remember this slogan, +09:40.040 --> 00:09:44.941 +Remember this slogan: "Any sufficiently advanced technology -09:41.200 --> 09:45.760 -any sufficiently advanced technology is indistinguishable from magic. +00:09:44.942 --> 00:09:47.600 +is indistinguishable from magic." -09:47.280 --> 09:51.600 -Here in this video, I'm going to use the term magic as a shorthand +09:47.600 --> 00:09:51.433 +Here in this video I'm going to use the term magic -09:51.600 --> 09:55.520 -for sufficiently advanced technology, +00:09:51.434 --> 00:09:55.262 +as a shorthand for sufficiently advanced technology -09:55.520 --> 09:59.040 -that is something that is complex and non-obvious, +00:09:55.263 --> 00:09:58.944 +that is something that is complex and non obvious -09:59.040 --> 10:01.840 +00:09:58.945 --> 00:10:01.920 and that is indistinguishable from magic -10:01.840 --> 10:04.640 +00:10:01.921 --> 00:10:05.840 in the sense of being almost impossible to understand. -10:05.600 --> 10:10.720 -And I'm also going to use the term black box as a near synonym for magic, +10:05.840 --> 00:10:09.272 +And I'm also going to use the term black box + +00:10:09.273 --> 00:10:11.408 +as a near synonym for magic + +00:10:11.409 --> 00:10:15.217 +and sometimes the term black box is more convenient -10:11.360 --> 10:15.360 -and sometimes the term black box is more convenient, +00:10:15.218 --> 00:10:17.488 +even though it's a bit longer, -10:15.360 --> 10:18.800 -even though it's a bit longer, it has more letters, +00:10:17.489 --> 00:10:21.333 +it has more letters because when I use the term black box -10:18.800 --> 10:20.880 -because when I use the term black box, +00:10:21.334 --> 00:10:23.521 +it invites us to use expressions -10:20.880 --> 10:25.440 -it invites us to use expressions like opening the black box, +00:10:23.522 --> 00:10:27.872 +like opening the black box -10:25.440 --> 10:27.840 +00:10:27.873 --> 00:10:34.800 and I'm going to use that expression a lot. -10:34.640 --> 10:37.360 -Now, let me try to explain what is... +10:34.800 --> 00:10:40.899 +Now let me try to explain what is. Sorry, -10:37.360 --> 10:40.400 -Sorry, let me change the font. +00:10:40.900 --> 00:10:44.240 +let me change the font. -10:44.000 --> 10:44.800 +NOTE Lua + +10:44.240 --> 10:45.240 What is Lua? -10:46.000 --> 10:51.840 -Lua is a minimalistic language in the sense of batteries not included. +10:45.240 --> 00:10:48.645 +Lua is a minimalistic language + +00:10:48.646 --> 00:10:53.040 +in the sense of battery is not included. -10:52.880 --> 10:56.640 -It uses associative tables for most of its data structures, +10:53.040 --> 00:10:57.987 +It uses associative tables for most of its data structures. -10:58.800 --> 11:02.240 -and it's so minimalistic that it's the default print function. +00:10:57.988 --> 00:11:00.874 +It's so minimalistic -11:03.120 --> 11:09.280 -When we create an associative table and we ask it to print... +00:11:00.875 --> 00:11:05.147 +that the default print function -11:11.760 --> 11:14.560 -We ask print to print an associative table, +00:11:05.148 --> 00:11:11.960 +when we create an associative table and we ask it to print-- -11:14.560 --> 11:17.280 +11:11.960 --> 00:11:14.914 +we ask print to print an associative table-- + +00:11:14.915 --> 00:11:17.600 it just prints the address of the table. -11:17.280 --> 11:18.480 -Here are some examples. +11:17.600 --> 00:11:20.902 +Here are some examples. Here is a table -11:19.920 --> 11:23.760 -Here is a table, and when we ask print to print it, +00:11:20.903 --> 00:11:23.296 +and when we ask to print it, -11:23.760 --> 11:26.720 +00:11:23.297 --> 00:11:28.200 it just says that it's the table at this address here. -11:27.440 --> 11:32.400 -So, one of the things that most people do when they start using Lua +11:28.200 --> 00:11:30.893 +One of the things that most people do + +00:11:30.894 --> 00:11:33.586 +when they start using Lua is that either -11:32.400 --> 11:36.320 -is that either they download a package with a print to printing function, +00:11:33.587 --> 00:11:36.313 +they download a package with a print to printing function -11:36.320 --> 11:38.720 +00:11:36.314 --> 00:11:39.520 or they write their own print to printing functions. -11:39.360 --> 11:42.000 -My own print to printing function is called pp, +11:39.520 --> 00:11:41.975 +My own print to printing function -11:42.000 --> 11:45.840 -with uppercase letters, and it works like this, +00:11:41.976 --> 00:11:44.450 +is called PP with upper case letters, -11:47.600 --> 11:50.880 -and it prints associative tables in a way like this. +00:11:44.451 --> 00:11:46.757 +and it works like this. -11:50.880 --> 11:54.800 +00:11:46.758 --> 00:11:52.072 +It prints associative tables in a way like this. + +00:11:52.073 --> 00:11:54.125 It says that for the key 1, -11:55.200 --> 11:57.280 -the value associated to it is 2, +00:11:54.126 --> 00:11:56.602 +the value associated to it is 2; -11:57.280 --> 11:59.200 -for the key 2, the value is 3, +00:11:56.603 --> 00:11:59.078 +for the key 2, the value is 3; -11:59.200 --> 12:01.760 +00:11:59.079 --> 00:12:09.240 and for the key 3, the value is 5. -12:08.960 --> 12:12.160 +12:09.240 --> 00:12:12.379 When I started using Lua, one of my favorite languages -12:12.160 --> 12:15.600 +00:12:12.380 --> 00:12:16.623 was also a language that used associative tables a lot. -12:15.600 --> 12:16.720 -It was called Icon, - -12:18.400 --> 12:22.640 -and I had to write my own print to printing functions for Icon. +00:12:16.624 --> 00:12:20.339 +It was called Icon. I had to write my own -12:22.720 --> 12:28.800 -So, I just had to port my print to printing functions to Lua, +00:12:20.340 --> 00:12:23.394 +print to printing functions for Icon, -12:28.800 --> 12:31.600 -and my first version looked something like this. +00:12:23.395 --> 00:12:29.425 +so I just had to port my print to printing functions to Lua. -12:32.240 --> 12:36.560 -It just had some global functions, lots of them actually, +00:12:29.426 --> 00:12:34.350 +My first version looked something like this. -12:39.680 --> 12:41.840 -and after a while I rewrote it, +00:12:34.351 --> 00:12:40.080 +it just had some global functions. Lots of them actually. -12:41.840 --> 12:44.320 -and I rewrote it again, and again, and again, +12:40.080 --> 00:12:41.933 +After a while, I rewrote it. -12:44.320 --> 12:49.200 -and this is one of the versions that is not even the default at this point. +00:12:41.934 --> 00:12:44.503 +I rewrote it again and again and again. -12:50.000 --> 12:53.920 -TOS is for toString, +00:12:44.504 --> 00:12:48.397 +This is one of the versions -12:56.800 --> 12:57.920 -and this is a demo. +00:12:48.398 --> 00:12:53.751 +that is not even the default at this point. -12:58.800 --> 13:04.560 -It's very modular, so it's easy to replace parts of it or to toggle flags, +00:12:53.752 --> 00:12:57.702 +`tos` is for to string. This is a demo. -13:04.560 --> 13:05.760 -and this is an example. +00:12:57.703 --> 00:13:02.905 +It's very modular, so it's easy to replace parts of it -13:05.760 --> 13:10.320 -If I try to print the table of methods for a certain class, +00:13:02.906 --> 00:13:06.567 +or to toggle flags. This is an example. -13:11.760 --> 13:13.040 -I'll need a smaller font, +00:13:06.568 --> 00:13:11.797 +If I try to print the table of methods for a certain class-- -13:14.320 --> 13:16.480 -it prints the table like this, +00:13:11.798 --> 00:13:16.245 +I only need a smaller font--it prints the table like this -13:16.480 --> 13:18.480 -with the names of the methods, +00:13:16.246 --> 00:13:18.510 +with the names of the methods -13:18.560 --> 13:21.520 +00:13:18.511 --> 00:13:22.360 and then links to the source code of the functions. -13:22.080 --> 13:25.360 -These links only make sense in Emacs and in Eevee, +13:22.360 --> 00:13:26.671 +These links only make sense in Emacs and in eev. -13:26.000 --> 13:28.560 -and when we run a link like this one, +00:13:26.672 --> 00:13:30.296 +When we run a link like this one, -13:29.840 --> 13:33.920 -it shows the source code in the window at the right. +00:13:30.297 --> 00:13:34.013 +it shows the source code and the window at the right. -13:33.920 --> 13:37.760 -So, for some functions, the source code is three lines, +00:13:34.014 --> 00:13:38.647 +For some functions, the source code is three lines. -13:37.760 --> 13:40.400 -for other ones it's one line, and whatever. +00:13:38.648 --> 00:13:42.320 +For other ones, it's one line and whatever. -13:41.920 --> 13:43.200 +13:42.320 --> 00:13:44.149 Anyway, let me go back. -13:45.360 --> 13:48.000 +00:13:44.150 --> 00:13:47.490 Lua can be used in many different styles. -13:48.000 --> 13:50.160 +00:13:47.491 --> 00:13:52.240 Most people hate other people's styles. -13:51.920 --> 13:56.080 +13:52.240 --> 00:13:55.252 When I started using it in the year 2000, -13:56.080 --> 13:59.040 +00:13:55.253 --> 00:13:59.566 I learned most of the basic language in a single day. -13:59.040 --> 14:02.000 -It was very similar to things that I was already using, +00:13:59.567 --> 00:14:04.042 +It was very similar to things that I was already using. -14:02.800 --> 14:08.560 -and then I rewrote the mini language that I was using +00:14:04.043 --> 00:14:08.388 +Then I rewrote the mini language -14:08.560 --> 14:14.800 -to generate the HTML for my pages in Lua. +00:14:08.389 --> 00:14:15.200 +that I was using to generate the HTML for my pages in Lua. -14:14.800 --> 14:16.960 -Actually, I had to rewrite it many times, +14:15.200 --> 00:14:17.591 +Actually, I had to rewrite it many times -14:16.960 --> 14:20.880 -but the first version I certainly did in my first weeks +00:14:17.592 --> 00:14:21.367 +but the first version I certainly did -14:20.880 --> 14:22.480 -or first months using Lua. +00:14:21.368 --> 00:14:25.740 +in my first weeks or first months using Lua. -14:25.520 --> 14:29.040 +14:25.740 --> 00:14:29.653 In the beginning, I was just using it for writing programs -14:29.040 --> 14:32.160 -that either didn't take in any input at all, +00:14:29.654 --> 00:14:32.876 +that either didn't take any input at all -14:32.160 --> 14:35.280 +00:14:32.877 --> 00:14:36.727 because the input was already in the source file, -14:35.280 --> 14:39.200 -or that worked as a Unix function, +00:14:36.728 --> 00:14:39.400 +or that worked as a Unix function: -14:39.200 --> 14:42.960 -the Unix programs that would read files +14:39.400 --> 00:14:42.451 +the Unix programs that would read files, -14:42.960 --> 14:46.160 -and process these files in some way and output something. +00:14:42.452 --> 00:14:49.560 +process these files in some way, and output something. -14:47.840 --> 14:52.480 -I mentioned the basic language here. +14:49.560 --> 00:14:52.200 +I mentioned the basic language here, -14:52.480 --> 14:55.520 -I only learned how to use closures, metatables, +00:14:52.201 --> 00:14:55.625 +I only learned how to use closures, meta tables, -14:55.520 --> 14:58.240 +00:14:55.626 --> 00:15:00.600 and coroutines many years later. -15:00.320 --> 15:02.240 -In the beginning, when I started using Lua, +15:00.600 --> 00:15:02.588 +In the beginning when I started using Lua -15:02.240 --> 15:04.080 +00:15:02.589 --> 00:15:04.199 it didn't have a package manager. -15:04.080 --> 15:05.200 -It appeared later. +00:15:04.200 --> 00:15:08.299 +It appeared later. It is called luarocks. -15:05.200 --> 15:06.560 -It is called Lua-rocks. - -15:07.680 --> 15:11.600 +00:15:08.300 --> 00:15:13.180 It has had this package manager for several years. -15:12.720 --> 15:15.520 -Most of the rocks for Lua-rocks are poorly documented, +15:13.180 --> 00:15:17.242 +Most of the rocks for luarocks are poorly documented -15:16.480 --> 15:19.040 -documented, and hacker-unfriendly, +00:15:17.243 --> 00:15:18.897 +and hacker-unfriendly. -15:19.040 --> 15:21.600 -so you can't rely just on the documentation, +00:15:18.898 --> 00:15:22.079 +You can't rely just on the documentation. -15:22.160 --> 15:24.320 -and you can't rely just on the source code, +00:15:22.080 --> 00:15:25.188 +You can't rely just on the source code, -15:24.320 --> 15:28.320 -because, I mean, if you're a genius, of course you can, +00:15:25.189 --> 00:15:28.706 +because--I mean, if you're a genius, of course you can, -15:28.320 --> 15:32.320 -but for people who are either lazy or dumb or whatever, +00:15:28.707 --> 00:15:31.544 +but for people who are either -15:32.320 --> 15:33.920 -like me, or unfocused, +00:15:31.545 --> 00:15:35.895 +lazy or dumb or whatever like me, or unfocused, -15:35.120 --> 15:37.120 +00:15:35.896 --> 00:15:39.490 the source code is hard to understand -15:37.120 --> 15:38.800 +00:15:39.491 --> 00:15:41.760 and hard to tinker with. -15:41.440 --> 15:43.040 +15:41.760 --> 00:15:43.760 Some rocks are excellent. -15:43.040 --> 15:46.640 +00:15:43.761 --> 00:15:46.452 The best rocks are well documented, -15:46.640 --> 15:48.640 -but they are hacker-unfriendly, +00:15:46.453 --> 00:15:48.760 +but they are hacker-unfriendly -15:48.640 --> 15:51.840 +15:48.760 --> 15:53.640 in the sense that I hope that I'll be able to explain soon. -15:53.440 --> 15:58.560 -The best rocks use local variables and metatables a lot, +15:53.640 --> 00:15:59.466 +The best rocks use local variables and meta tables a lot, -15:59.280 --> 16:03.120 -so if you are a beginner learning Lua, +00:15:59.467 --> 00:16:02.905 +so if you are a beginner learning Lua -16:03.120 --> 16:06.080 +00:16:02.906 --> 00:16:08.245 you're not going to understand what their source codes do. -16:06.080 --> 16:08.320 +00:16:08.246 --> 00:16:10.960 They use lots of dirty tricks. -16:08.640 --> 16:12.240 +NOTE Object orientation in Lua + +16:10.960 --> 16:14.360 Let me talk a bit about object orientation in Lua. -16:12.240 --> 16:13.840 -It can be done in many ways. +16:14.360 --> 00:16:18.275 +It can be done in many ways. The main book about Lua -16:15.360 --> 16:18.000 -The main book about Lua, called Programming in Lua, +00:16:18.276 --> 00:16:20.140 +called Programming in Lua -16:18.000 --> 16:20.240 -by one of the authors of the language, +00:16:20.141 --> 00:16:22.865 +by one of the authors of the language -16:21.120 --> 16:22.320 -Roberto Ierzalimschi, +00:16:22.866 --> 00:16:24.729 +called Roberto Ierusalimschy -16:23.200 --> 16:26.960 +00:16:24.730 --> 00:16:28.680 presents several ways of doing object orientation in Lua. -16:26.960 --> 16:29.040 +16:28.680 --> 00:16:31.386 I hated all of these ways, -16:29.840 --> 16:32.720 +00:16:31.387 --> 00:16:36.056 and also the ways that I tried from the rocks. -16:34.400 --> 16:36.880 -And then I wrote my own way, +00:16:36.057 --> 00:16:37.933 +Then I wrote my own way -16:37.360 --> 16:40.160 -wrote my own way of doing object orientation in Lua. +00:16:37.934 --> 00:16:40.347 +of doing object orientation in Lua. -16:40.160 --> 16:41.440 -It's very minimalistic. +00:16:40.348 --> 00:16:45.653 +It's very minimalistic. It's in this file here eoo.lua. -16:42.000 --> 16:45.120 -It's in this file here, eoo.lua. +00:16:45.654 --> 00:16:49.898 +The main code is just these five lines here. -16:47.040 --> 16:49.440 -The main code is just these five lines here, +00:16:49.899 --> 00:16:56.400 +Here's an example of how it works. -16:50.640 --> 16:53.120 -and here's an example of how it works. +16:56.400 --> 00:17:03.001 +We define a class vector with some meta methods. -16:56.080 --> 17:02.640 -Here we define a class vector with some metamethods. +00:17:03.002 --> 00:17:06.294 +This meta method here will tell Lua -17:02.640 --> 17:07.920 -This metamethod here will tell Lua what to do +00:17:06.295 --> 00:17:10.867 +what to do when the user asks to add two vectors. -17:07.920 --> 17:11.040 -when the user asks to add two vectors. - -17:11.600 --> 17:14.320 +00:17:10.868 --> 00:17:13.986 This one here tells Lua what to do -17:14.320 --> 17:18.320 -when the user asks Lua to convert a vector to a string, +00:17:13.987 --> 00:17:18.888 +when the user asks Lua to convert a vector to a string -17:18.880 --> 17:20.640 -and whatever. +00:17:18.889 --> 00:17:22.007 +and whatever. This one is something -17:20.640 --> 17:23.920 -This one is something that I'm going to explain in a second. +00:17:22.008 --> 00:17:25.580 +that I'm going to explain in a second. -17:25.360 --> 17:28.240 -So here we create a vector with these coordinates, +17:25.580 --> 00:17:25.580 +Here we create a vector -17:28.240 --> 17:29.360 -three and four. +00:17:25.580 --> 00:17:25.580 +with these coordinates 3 and 4. -17:29.360 --> 17:31.360 +00:17:25.581 --> 00:17:25.580 Here we create another vector. -17:31.360 --> 17:35.200 -If we print here, then Lua uses the function here +17:31.600 --> 00:17:33.030 +If we print here, -17:35.200 --> 17:36.160 -in the toString. +00:17:33.031 --> 00:17:37.153 +then Lua uses the function here in the `__tostring`. -17:37.200 --> 17:40.880 -If we add two vectors, it uses the function here +00:17:37.154 --> 00:17:38.907 +If we add two vectors -17:40.880 --> 17:42.400 -in the add metamethod. +00:17:38.908 --> 00:17:42.653 +it uses the function here in the `__add` meta method. -17:42.960 --> 17:45.280 -And if we run the method norm, +00:17:42.654 --> 00:17:45.044 +If we run the method `norm`, -17:45.280 --> 17:49.760 +00:17:45.045 --> 00:17:51.680 it is defined here in the table index. -17:51.280 --> 17:51.780 -Anyway. - -17:52.740 --> 17:54.740 -Even this thing being so small, +17:51.680 --> 00:17:57.675 +Anyway, even with this thing being so small, -17:54.740 --> 17:58.500 -I used to forget how it's in odds worked all the time. +00:17:57.676 --> 00:18:04.617 +I used to forget how it works all the time. -17:58.500 --> 18:01.700 +00:18:04.618 --> 00:18:08.200 Actually, I always forget how things work, -18:01.700 --> 18:03.940 +00:18:08.201 --> 00:18:11.347 and I have to remember them somehow. -18:03.940 --> 18:07.940 -And I have to have tricks for remembering - -18:07.940 --> 18:11.940 -and tricks for summarizing things and diagrams and so on. +00:18:11.348 --> 00:18:14.920 +I have to have tricks for remembering, -18:13.540 --> 18:15.940 -And every time that I forgot how to do it, +00:18:14.921 --> 00:18:19.769 +and tricks for summarizing things and diagrams, and so on. -18:15.940 --> 18:17.220 -I just go back to the code. +00:18:19.770 --> 00:18:23.309 +Every time that I forgot how this thing worked, -18:17.220 --> 18:18.420 -I just go back to the code. +00:18:23.310 --> 00:18:25.460 +I went back to the source code -18:18.500 --> 18:23.140 -And every time that I forgot how this thing worked, +00:18:25.461 --> 00:18:28.148 +and then I looked at the diagrams, -18:23.140 --> 18:25.540 -I went back to the source code, +00:18:28.149 --> 00:18:30.994 +or, of course, the first time, -18:25.540 --> 18:27.380 -and then I looked at the diagrams. +00:18:30.995 --> 00:18:33.800 +I had to draw the diagrams. I run the examples. -18:27.380 --> 18:29.940 -Or, of course, in the first time, +00:18:33.801 --> 00:18:35.539 +Of course, in the beginning -18:29.940 --> 18:31.460 -I had to draw the diagrams. - -18:32.260 --> 18:34.420 -And I run the examples. - -18:34.420 --> 18:35.780 -And, of course, in the beginning, - -18:35.780 --> 18:37.460 +00:18:35.540 --> 00:18:37.503 I thought that the code was clear. -18:37.460 --> 18:38.900 +00:18:37.504 --> 00:18:39.737 My examples were very brief. -18:38.900 --> 18:42.820 -And so I had to rewrite the examples many times +00:18:39.738 --> 00:18:43.565 +So I had to rewrite the examples many times -18:42.820 --> 18:46.420 -until they became, let's say, perfect. +00:18:43.566 --> 00:18:50.880 +until they became let's say perfect. -18:48.660 --> 18:53.220 -And I was saying that Lua can be used in many ways. +18:50.880 --> 00:18:54.090 +I was saying that Lua can be used in many ways -18:53.780 --> 18:57.700 -And in my way of using Lua, my favorite way, +00:18:54.091 --> 00:18:58.403 +and in my way of using Lua, in my favorite way, -18:57.700 --> 19:02.020 -everything can be inspected and modified from REPLs, +00:18:58.404 --> 00:19:03.075 +everything can be inspected and modified from REPLs -19:03.140 --> 19:07.140 -like we can do in MX and in Smalltalk, or sort of. +00:19:03.076 --> 00:19:06.817 +like we can do in Emacs and in SmallTalk, sort of. -19:07.860 --> 19:09.940 -So in my favorite way of using Lua, +00:19:06.818 --> 00:19:09.436 +In my favorite way of using Lua -19:09.940 --> 19:11.860 +00:19:09.437 --> 00:19:11.531 there's no security at all. -19:11.860 --> 19:14.740 +00:19:11.532 --> 00:19:17.460 Everything can be changed at all times. -19:15.140 --> 19:16.980 +19:17.460 --> 00:19:19.822 Of course, most people hate that. -19:17.780 --> 19:20.180 -My init file has lots of classes. +NOTE My init file -19:20.820 --> 19:24.100 -And, by the way, instead of keeping many small files +00:19:19.823 --> 00:19:22.185 +My init file has lots of classes, -19:24.100 --> 19:25.140 -with many things, +00:19:22.186 --> 00:19:24.701 +and by the way, instead of -19:25.140 --> 19:29.300 -I put lots of stuff in just one big init file. +00:19:24.702 --> 00:19:28.636 +keeping many small files with many things, -19:31.060 --> 19:33.860 -My init file has lots of classes +00:19:28.637 --> 00:19:33.000 +I put lots of stuff in just one big init file. -19:33.860 --> 19:36.660 -and lots of global functions and lots of crafts. +19:33.000 --> 00:19:35.520 +My init file has lots of classes, -19:36.660 --> 19:40.020 -So people hate that, of course. +00:19:35.521 --> 00:19:39.187 +and lots of global functions and lots of cruft, -19:41.380 --> 19:42.580 -This is an example. +00:19:39.188 --> 00:19:43.700 +so people hate that, of course. -19:43.460 --> 19:44.500 +19:43.700 --> 00:19:46.340 This is an example. -19:44.500 --> 19:48.260 +00:19:46.341 --> 00:19:52.415 This is the index at the top of my init file. -19:50.580 --> 19:52.820 -The classes start here. - -19:55.060 --> 19:57.220 -And then we have some functions. - -19:57.780 --> 20:02.500 -And then we have functions that load certain packages. +00:19:52.416 --> 00:19:57.541 +The classes start here. Then we have some functions -20:02.500 --> 20:03.540 -And then we have craft. +00:19:57.542 --> 00:20:02.480 +and then we have functions that load certain packages, -20:04.260 --> 20:04.760 -Whatever. +20:02.480 --> 20:06.580 +and then we have cruft, whatever. -20:06.180 --> 20:08.580 +20:06.580 --> 00:20:08.923 Most people think that my style of using Lua -20:08.580 --> 20:10.340 -is dirty and dangerous. +00:20:08.924 --> 00:20:10.122 +is dirty and dangerous, -20:10.340 --> 20:11.860 -And they wouldn't touch my Lua code. +00:20:10.123 --> 00:20:14.287 +and they wouldn't touch my Lua code with a 10 feet pole, -20:12.100 --> 20:13.140 -With a 10-feet pole. +00:20:14.288 --> 00:20:15.968 +but most of the things -20:14.740 --> 20:18.100 -But most of the things that I'm going to present here +00:20:15.969 --> 00:20:19.256 +that I'm going to present here in this presentation -20:18.100 --> 20:20.740 -in this presentation are ideas that should be easy +00:20:19.257 --> 00:20:23.050 +are ideas that should be easy to port to other environments -20:20.740 --> 20:24.180 -to port to other environments and other languages. +00:20:23.051 --> 00:20:27.738 +and other languages, especially the diagrams, -20:24.180 --> 20:25.780 -Especially the diagrams. +00:20:27.739 --> 00:20:31.000 +so the code is not so important. -20:25.780 --> 20:27.620 -So the code is not so important. +NOTE LaTeX and LuaLaTeX -20:30.740 --> 20:33.140 -Now let me talk a bit about LaTeX. +20:31.000 --> 00:20:34.640 +Now let me talk a bit about LaTeX, LuaLaTeX, -20:33.140 --> 20:33.860 -Lua LaTeX. +00:20:34.641 --> 00:20:39.249 +that is LaTeX with the Lua interpreter embedded inside -20:33.860 --> 20:38.820 -That is LaTeX with the Lua interpreter embedded inside. +00:20:39.250 --> 00:20:43.182 +and two ways of generating pictures in LaTeX: -20:39.380 --> 20:43.300 -And two ways of generating pictures in LaTeX. +00:20:43.183 --> 00:20:45.115 +TikZ that is very famous, -20:43.300 --> 20:44.820 -Text that is very famous. +00:20:45.116 --> 00:20:48.311 +and Pict2e that is not very famous -20:44.820 --> 20:47.300 -And picture that is not very famous. +00:20:48.312 --> 00:20:50.644 +and that is very low level, -20:47.300 --> 20:48.900 -And that is very low level. +00:20:50.645 --> 00:20:53.840 +and I think that not many people use. -20:48.900 --> 20:51.700 -And I think that not many people use. - -20:53.700 --> 20:57.300 +20:53.840 --> 00:20:57.048 I said before that when I learned Lua, -20:57.300 --> 21:01.540 -I realized that it was very good for writing little languages. +00:20:57.049 --> 00:21:00.354 +I realized that it was very good -21:03.220 --> 21:05.220 -I was doing my PhD at the time. +00:21:00.355 --> 00:21:03.360 +for writing literal languages. -21:05.300 --> 21:11.220 -And typesetting the diagrams for my PhD thesis was very boring. +21:03.360 --> 00:21:05.986 +I was doing my PhD at the time -21:11.220 --> 21:14.100 -So one of the things that I did was that I created +00:21:05.987 --> 00:21:09.969 +and typesetting the diagrams for my PhD thesis -21:14.980 --> 21:17.540 -a little language for typesetting the diagrams for me. +00:21:09.970 --> 00:21:11.240 +was very boring. -21:19.140 --> 21:20.900 -It was called DEDNOT. +21:11.240 --> 00:21:13.864 +One of the things that I did was that -21:20.900 --> 21:25.300 -Because initially it only generated diagrams +00:21:13.865 --> 00:21:15.720 +I created a literal language -21:25.300 --> 21:26.820 -for natural deduction. +00:21:15.721 --> 00:21:19.340 +for typesetting the diagrams for me. -21:26.820 --> 21:28.580 -And then it had several versions. +21:19.340 --> 00:21:22.821 +It was called Dednat because initially -21:30.180 --> 21:34.420 -These are the slides for my presentation about DEDNOT6. +00:21:22.822 --> 00:21:26.800 +it only generated diagrams for natural deduction -21:34.420 --> 21:39.140 -And DEDNOT6 is an extensible semi-preprocessor for Lua LaTeX +21:26.800 --> 21:30.440 +and then it had several versions. -21:39.140 --> 21:41.780 -that understands diagrams in ASCII art. +21:30.440 --> 00:21:34.379 +These are the slides from my presentation about Dednat6 -21:42.340 --> 21:48.740 -In the sense that when I have a LaTeX file that has this. +00:21:34.380 --> 00:21:38.990 +and Dednat6 is an extensible semi preprocessor -21:49.380 --> 21:51.860 -And when DEDNOT6 is loaded. +00:21:38.991 --> 00:21:43.691 +for LuaLaTeX that understands diagrams in ASCII art -21:53.220 --> 21:58.820 -When I give the right commands, DEDNOT6 interprets this block here +00:21:43.692 --> 00:21:49.034 +in the sense that when I have a TeX file that has this, -21:58.820 --> 22:00.980 -as something that defines this diagram. +00:21:49.035 --> 00:21:52.143 +and when Dednat6 is loaded, -22:02.260 --> 22:03.540 -Oops, sorry. +00:21:52.144 --> 00:21:55.708 +when I get the right comments, -22:05.380 --> 22:07.540 -It interprets this diagram here. +00:21:55.709 --> 00:22:00.342 +Dednat6 interprets this block here -22:08.340 --> 22:10.900 -This diagram in the comments here +00:22:00.343 --> 00:22:05.095 +as something that defines this diagram. -22:11.460 --> 22:14.260 -as something that defines a diagram called foo, +00:22:05.096 --> 00:22:07.828 +It interprets this diagram here, -22:14.260 --> 22:16.100 -a deduction called foo. +00:22:07.829 --> 00:22:10.643 +this diagram in the comments here, -22:16.100 --> 22:19.140 -And it generates this code here. +00:22:10.644 --> 00:22:16.432 +as something that defines a diagram called `foo`, -22:19.940 --> 22:27.300 -So that we can just invoke the definition of the deduction +00:22:16.433 --> 00:22:23.064 +a deduction called `foo`, and it generates this code here -22:27.300 --> 22:30.260 -by typing backslash DED foo. +00:22:23.065 --> 00:22:28.867 +so that we can just invoke the definition of the deduction -22:31.220 --> 22:37.140 -And DEDNOT6 also supports another language +00:22:28.868 --> 00:22:31.720 +by typing `\ded{foo}`. -22:37.140 --> 22:39.860 -for typesetting bi-dimensional diagrams +22:31.720 --> 00:22:36.148 +Dednat6 also supports another language -22:39.860 --> 22:42.660 -with arrows and stuff for category theory and blah blah. +00:22:36.149 --> 00:22:40.579 +for typesetting bidimensional diagrams with arrows and stuff -22:44.180 --> 22:46.900 -The specifications of these diagrams look like this. +00:22:40.580 --> 00:22:43.122 +for category theory and blah blah. -22:49.540 --> 22:53.540 -Here is a very good example. +00:22:43.123 --> 00:22:46.100 +The specifications of these diagrams -22:55.540 --> 22:56.980 -This is a huge diagram. +22:46.100 --> 00:22:53.865 +look like this. Here is a very good example. -22:58.420 --> 22:59.460 -Sorry, one second. +00:22:53.866 --> 00:23:00.940 +This is a huge diagram. Sorry, one second. -23:00.740 --> 23:03.620 +23:00.940 --> 00:23:04.757 So the source code that generates this diagram here -23:03.620 --> 23:05.140 -is just this thing at the left. - -23:07.220 --> 23:08.340 -So it's very visual. +00:23:04.758 --> 00:23:08.628 +is just this thing at the left. It's very visual. -23:09.220 --> 23:12.340 +00:23:08.629 --> 00:23:11.842 We can typeset the diagram in ASCII art here. -23:12.340 --> 23:13.780 -And then in this part here, +00:23:11.843 --> 00:23:14.434 +Then in this part here, -23:13.780 --> 23:16.660 +00:23:14.435 --> 00:23:18.273 we tell how the nodes are to be joined, -23:17.620 --> 23:20.660 -which arrows have to have annotations and so on. +00:23:18.274 --> 00:23:22.880 +which arrows have to have annotations, and so on. -23:22.420 --> 23:25.460 -And this language is extensible in the sense that... +23:22.880 --> 00:23:30.950 +This language is extensible in the sense that -23:25.780 --> 23:26.580 -Where is that? +00:23:30.951 --> 00:23:37.280 +here, comments that start -23:32.020 --> 23:32.520 -Here. +23:37.280 --> 00:23:42.690 +with `%:` are interpreted as definitions -23:34.420 --> 23:36.660 -Comments that start with percent colon +00:23:42.691 --> 00:23:44.819 +for tree diagrams, -23:37.940 --> 23:41.620 -are interpreted as definitions for three diagrams. +00:23:44.820 --> 00:23:49.394 +lines that start with `%D` -23:43.620 --> 23:47.220 -Lines that start with percent uppercase D +00:23:49.395 --> 00:23:53.761 +define 2D diagrams with arrows and stuff, -23:47.220 --> 23:52.260 -define 2D diagrams with arrows and stuff. +00:23:53.762 --> 00:23:57.683 +and lines that start with command `%L` -23:52.740 --> 23:58.020 -And lines that start with comment uppercase L +00:23:57.684 --> 00:24:01.197 +contain blocks of Lua code that we can use -23:58.660 --> 24:00.580 -contain blocks of Lua code +00:24:01.198 --> 00:24:05.527 +to extend the interpreter on the flag. -24:00.580 --> 24:04.180 -that we can use to extend the interpreter on the flag. +00:24:05.528 --> 00:24:09.746 +Anyway, here are some recent examples -24:06.020 --> 24:09.860 -Anyway, here are some recent examples of diagrams +00:24:09.747 --> 00:24:16.146 +of diagrams that I used Dednat6 to typeset. -24:09.860 --> 24:14.580 -that I used DEDNOT6 to typeset. +00:24:16.147 --> 00:24:24.494 +This diagram here was generated by this specification here, -24:15.780 --> 24:17.220 -This diagram here +00:24:24.495 --> 00:24:30.619 +and this diagram here with the curved arrows -24:17.780 --> 24:20.580 +00:24:30.620 --> 00:24:36.200 was generated by this specification here. -24:23.460 --> 24:26.980 -And this diagram here with the curved arrows - -24:27.780 --> 24:30.580 -was generated by this specification here. - -24:34.180 --> 24:37.220 -So DEDNOT6 was very easy to extend. - -24:37.220 --> 24:38.260 -At that some point, +24:36.200 --> 00:24:39.174 +Dednat6 was very easy to extend. -24:38.260 --> 24:42.820 -I started to use it to generate diagrams using Peaked Chewy, +00:24:39.175 --> 00:24:43.043 +At some point I started to use it to generate diagrams -24:42.820 --> 24:45.540 -mainly for the classes that I gave you. +00:24:43.044 --> 00:24:46.067 +using Pict2e, mainly for the classes -24:45.540 --> 24:48.420 -For the classes that I give at the university. +00:24:46.068 --> 00:24:49.673 +that I give at the university, -24:48.420 --> 24:50.900 -I teach mathematics and whatever. +00:24:49.674 --> 00:24:53.861 +I teach mathematics in a place. -24:51.860 --> 24:52.900 -In a bad place. +00:24:53.862 --> 00:24:58.979 +Let me show an animation. Here is a diagram -24:52.900 --> 24:53.400 -Whatever. +00:24:58.980 --> 00:25:02.325 +that I generated with Dednat6. -24:56.260 --> 24:58.500 -Let me show an animation. +00:25:02.326 --> 00:25:05.385 +It is a flipbook animation, -24:59.060 --> 25:02.420 -Here is a diagram that I generated with DEDNOT6. +00:25:05.386 --> 00:25:08.253 +we type page up and page down, -25:02.980 --> 25:05.300 -And it is a flipbook animation. - -25:05.300 --> 25:08.740 -Like we type page up and page down - -25:08.740 --> 25:10.660 +00:25:08.254 --> 00:25:10.783 and we go to the next page of the book -25:10.660 --> 25:12.340 +00:25:10.784 --> 00:25:13.248 and to the previous page of the book. -25:13.060 --> 25:15.940 -And here is the source code that generates that. +00:25:13.249 --> 00:25:16.924 +Here is the source code that generates that. -25:16.980 --> 25:19.140 -This source code is not very visual. +00:25:16.925 --> 00:25:19.700 +This source code is not very visual, -25:19.140 --> 25:22.740 -So it's quite clumsy to edit a diagram +00:25:19.701 --> 00:25:21.800 +so it's quite clumsy to edit -25:22.740 --> 25:25.460 -directly in the tag file like that. +25:21.800 --> 25:28.280 +a diagram directly in the TeX file like that. -25:28.020 --> 25:31.860 -These diagrams were inspired by something called Manim. +NOTE Manim -25:32.500 --> 25:33.000 -That's... +25:28.280 --> 00:25:33.437 +These diagrams were inspired by something called Manim. -25:34.580 --> 25:36.340 -Oh, I've forgotten the name of the guy. +00:25:33.438 --> 00:25:36.713 +I've forgotten the name of the guy, but it's a guy -25:36.340 --> 25:39.300 -But it's a guy that makes many videos about mathematics. +00:25:36.714 --> 00:25:39.346 +that makes many videos about mathematics, -25:39.300 --> 25:41.780 -And he created this library called Manim +00:25:39.347 --> 00:25:43.373 +and he created this library called Manim -25:41.780 --> 25:43.460 +00:25:43.374 --> 00:25:46.417 for generating his animations. -25:45.540 --> 25:51.460 +00:25:46.418 --> 00:25:52.083 Other people adapted his library to make it more accessible. -25:52.580 --> 25:53.700 -I tried to learn it. +00:25:52.084 --> 00:25:55.799 +I tried to learn it, but each animation, -25:53.700 --> 25:55.700 -But each animation, - -25:57.060 --> 25:59.220 +00:25:55.800 --> 00:25:59.191 even an animation with very few frames, -25:59.220 --> 26:01.300 -each animation took ages to render. - -26:01.300 --> 26:03.060 -So it wasn't fun. +00:25:59.192 --> 00:26:03.770 +each animation took ages to render, so it wasn't fun. -26:03.700 --> 26:07.060 -And animations and PDFs can be rendered in seconds. +00:26:03.771 --> 00:26:08.345 +Animations and PDFs can be rendered in seconds, -26:07.940 --> 26:11.060 -So these things were fun for me +00:26:08.346 --> 00:26:11.160 +so these things were fun for me -26:11.060 --> 26:15.300 +00:26:11.161 --> 00:26:17.440 because my laptop is very slow and Manim was not fun. -26:20.100 --> 26:26.020 -Anyway, writing code like this inside the attack file +26:17.440 --> 00:26:24.263 +Anyway, writing code like this inside a TeX file -26:26.020 --> 26:29.620 +00:26:24.264 --> 00:26:30.879 was not very fun because it was hard to debug. -26:30.500 --> 26:35.860 -So in 2022, I started to play with ways - -26:35.860 --> 26:40.340 -of generating these diagrams from REPLs. - -26:40.980 --> 26:44.500 -And I found a way for PIC2E and a way for TIX. - -26:45.380 --> 26:47.780 -Each one of these ways became a video. - -26:48.740 --> 26:53.780 -If you go to the list of first class videos of EEV, - -26:53.780 --> 26:57.540 -you're going to see that there's a video about PIC2E here - -26:57.540 --> 26:58.740 -and a video about TIX. - -27:00.340 --> 27:07.540 -Here you have some information like length and explanation, etc. - -27:08.180 --> 27:10.420 -And here are the pages for these videos. - -27:12.420 --> 27:15.860 -My page about the video, about PIC2E is like this. +NOTE Generating diagrams from REPLs -27:15.860 --> 27:18.740 -It has some diagrams, whatever. +00:26:30.880 --> 00:26:36.510 +In 2022, I started to play with ways -27:18.740 --> 27:20.980 -And this one is much nicer. +00:26:36.511 --> 00:26:42.000 +of generating these diagrams from REPLs -27:20.980 --> 27:26.100 -And a lot of people watched that video. +26:42.000 --> 00:26:46.309 +and I found a way for Pict2e and a way for Tikz. -27:26.100 --> 27:30.260 -I mean, I thought that 250 people watched it. - -27:30.900 --> 27:33.940 -For me, that's a million of people. - -27:36.660 --> 27:42.900 -And this video is about how to extract diagrams from the TIX manual - -27:42.900 --> 27:47.700 -and how to run those examples in a REPL - -27:47.700 --> 27:49.780 -and modify them bit by bit. - -27:49.780 --> 27:51.380 -This is a screenshot. - -27:52.100 --> 27:53.620 -But let me go back. +00:26:46.310 --> 00:26:49.520 +Each one of these ways became a video. -27:56.420 --> 27:59.700 -At that point, these things were just prototypes. +26:49.520 --> 00:26:53.220 +If you go to the list of first class videos of eev, -27:59.700 --> 28:01.460 -The code was not very nice. +00:26:53.221 --> 00:26:55.088 +you're going to see -28:02.020 --> 28:10.500 -And in this year, I was able to unify those two ways of generating PDFs, +00:26:55.089 --> 00:26:59.010 +that there's a video about Pict2e here -28:11.380 --> 28:14.100 -the one for TIX and the one for PIC2E. +00:26:59.011 --> 00:27:01.158 +and a video about Tikz. -28:14.100 --> 28:18.740 -And I unified them with many other things that generated diagrams. +00:27:01.159 --> 00:27:04.187 +Here you have some information -28:19.220 --> 28:27.460 -The basis of these things is something called showchew.lua. +00:27:04.188 --> 00:27:07.508 +like length and explanation, etc. -28:27.460 --> 28:31.380 -I'm not going to show its details now. +00:27:07.509 --> 00:27:11.513 +Here are the pages for these videos. -28:32.100 --> 28:40.420 -But its extension that generates TIX code is just this. +00:27:11.514 --> 00:27:15.991 +My page about the video about Pict2e is like this. -28:40.420 --> 28:45.540 -So we can specify a diagram with just a block like this. +00:27:15.992 --> 00:27:20.800 +It has some diagrams. This one is much nicer. -28:46.260 --> 28:54.180 -And then if we run show00 and it returns a string +27:20.800 --> 00:27:26.605 +A lot of people watched that video. I mean, -28:54.180 --> 28:58.580 -that is just the inner body of the TIX file. +00:27:26.606 --> 00:27:31.080 +I thought that 250 people watched it. -28:59.220 --> 29:02.020 -If we run this, we see the whole TIX file. +27:31.080 --> 00:27:35.344 +For me, that's a million of people. -29:02.020 --> 29:04.340 -And if we run this, we save the TIX file +00:27:35.345 --> 00:27:40.402 +This video is about how to extract diagrams -29:04.340 --> 29:08.420 -and we compile the TIX file to generate a PDF. +00:27:40.403 --> 00:27:46.512 +from the Tikz manual, and how to run those examples in REPL -29:08.420 --> 29:14.180 -And if we run this, we show the PDF in the lower right window. +00:27:46.513 --> 00:27:52.936 +and modify them bit by bit. This is a screenshot. -29:16.020 --> 29:20.740 -And that's the same thing for all my recent programs that generate PDFs. +00:27:52.937 --> 00:27:57.432 +Let me go back. At that point, -29:21.620 --> 29:22.980 -They are all integrated. +00:27:57.433 --> 00:28:01.800 +these things were just prototypes, -29:24.500 --> 29:30.660 -Here is the one that the basis for all my modules that generate diagrams with PIC2E. +28:01.800 --> 00:28:04.803 +the code was not very nice, -29:33.060 --> 29:34.980 -Its demos are not very interesting. +00:28:04.804 --> 00:28:07.592 +and in this year I wrote... -29:34.980 --> 29:39.700 -So let me show some demos of extensions that do interesting things. +00:28:07.593 --> 00:28:12.123 +I was able to unify those two ways of generating PDFs, -29:40.660 --> 29:47.220 -So this is a diagram that I created by editing it in a REPL. +00:28:12.124 --> 00:28:15.665 +the one for Tikz and the one for Pict2e. -29:48.820 --> 29:51.220 -I create several PIC2E objects here. +00:28:15.666 --> 00:28:19.196 +I unified them with many other things -29:52.500 --> 29:58.660 -And if I execute this, it compiles the object, generates a PDF. +00:28:19.197 --> 00:28:21.298 +that generated diagrams. -29:58.660 --> 30:03.860 -And if I tap this, here is the PDF. +00:28:21.299 --> 00:28:28.430 +The basis of these things is something called Show2.lua. -30:04.740 --> 30:10.020 -And if I just ask Lua to display what is books here, +00:28:28.431 --> 00:28:33.935 +I'm not going to just show its details now, -30:11.700 --> 30:17.220 -it shows the source code in PIC2E of the diagram. +00:28:33.936 --> 00:28:38.775 +but it's an extension that generates Tikz code. -30:17.940 --> 30:20.340 -And the nice thing is that it is indented. +00:28:38.776 --> 00:28:43.305 +It's just this. We can specify a diagram -30:20.340 --> 30:23.460 -So it's easy to debug the PIC2E code. +00:28:43.306 --> 00:28:50.538 +with just a block like this, and then if we run `show00`, -30:24.340 --> 30:30.180 -If anyone is interested, the module that does the tricks for indentation +00:28:50.539 --> 00:28:53.694 +it returns a string -30:30.180 --> 30:31.460 -is very easy to understand. +00:28:53.695 --> 00:28:59.480 +that is just the inner body of the TeX file. -30:31.540 --> 30:34.500 -It has lots of tests and test blocks. +28:59.480 --> 00:29:02.306 +If we run this, we see the whole TeX file. -30:34.500 --> 30:39.060 -And I think that its data structures are easy to understand. +00:29:02.307 --> 00:29:05.200 +If we run this we save the TeX file and -30:42.500 --> 30:44.820 -Anyway, here is another example. +29:05.200 --> 00:29:09.196 +we compile the TeX file to generate a PDF. -30:50.260 --> 30:51.620 -The show is here. +00:29:09.197 --> 00:29:12.557 +If we run this, we show the PDF -30:53.460 --> 30:56.340 -It generates a 3D diagram. +00:29:12.558 --> 00:29:15.078 +in the lower right window. -31:02.420 --> 31:08.500 -Now let me talk about parsers and REPLs in a very strange place. +00:29:15.079 --> 00:29:20.026 +That's the same thing for all my recent programs -31:09.140 --> 31:18.340 -I mean, using REPLs to build parsers step by step and replacing parts by more complex parts. +00:29:20.027 --> 00:29:23.810 +that generate PDFs. They are all integrated. -31:21.060 --> 31:23.780 -So I said that Lua is very minimalistic. +00:29:23.811 --> 00:29:28.267 +Here is the basis for all my modules -31:25.780 --> 31:30.660 -And everybody knows that implementations of regular expressions +00:29:28.268 --> 00:29:31.423 +that generate diagrams with Pict2e. -31:30.740 --> 31:31.780 -are big and complex. +00:29:31.424 --> 00:29:34.337 +Its demos are not very interesting. -31:33.060 --> 31:39.220 -So instead of coming with full regular expressions, Lua comes with something called patterns +00:29:34.338 --> 00:29:38.556 +Let me show some demos of extensions -31:39.220 --> 31:43.620 -and a library function called string.match. +00:29:38.557 --> 00:29:43.723 +that do interesting things. This is a diagram -31:45.380 --> 31:54.420 -Here is a copy of the part of the manual that explains a part of the syntax of patterns. +00:29:43.724 --> 00:29:47.901 +that I created by editing it in a REPL, -31:56.260 --> 32:00.100 -Here's how string.match is described in the manual. +00:29:47.902 --> 00:29:51.871 +I create several Pict objects here. -32:01.220 --> 32:02.500 -It's just this. +00:29:51.872 --> 00:29:57.818 +If I execute this, it compiles the object and -32:02.500 --> 32:06.260 -Looks for the first match of pattern in the string as blah, blah, blah. +00:29:57.819 --> 00:30:04.523 +generates a PDF. If I tap this, here is the PDF. -32:07.220 --> 32:11.300 -And then we have to go to the other section of the manual that explains patterns. +00:30:04.524 --> 00:30:10.919 +If I just ask Lua to display what is pux here, -32:17.780 --> 32:26.500 -Lua patterns are so simple, so limited, that they don't even have the alternation operator. +00:30:10.920 --> 00:30:17.435 +it shows the source code in Pict2e of the diagram. -32:27.220 --> 32:31.460 -Here is how it is described in the ELLISP manual. +00:30:17.436 --> 00:30:20.932 +The nice thing is that it is indented, -32:33.300 --> 32:37.780 -Backslash pipe specifies an alternative, blah, blah, blah. +00:30:20.933 --> 00:30:24.348 +so it's easy to debug the Pict2e code. -32:40.820 --> 32:47.940 -When we want to build more complex regular expressions, patterns, grammars, etc., +00:30:24.349 --> 00:30:28.504 +If anyone is interested, the module that does the tricks -32:47.940 --> 32:51.780 -we have to use an external library for that. +00:30:28.505 --> 00:30:31.947 +for indentation is very easy to understand. -32:52.740 --> 32:59.140 -No, sorry, a library that is external, but that was written by one of the authors of Lua itself. +00:30:31.948 --> 00:30:34.920 +it has lots of tests and test blocks, -33:00.340 --> 33:05.380 -This library is called LPEG, and its manual says, +00:30:34.921 --> 00:30:47.438 +and I think that its data structures are easy to understand. -33:06.180 --> 33:11.940 -LPEG is a new pattern matching library for Lua based on parsing expression grammars, PEGs. +00:30:47.439 --> 00:30:57.904 +Anyway, here is another example, the show is here. -33:14.900 --> 33:17.460 -The manual is very terse. +00:30:57.905 --> 00:31:03.240 +It generates a 3D diagram. -33:18.180 --> 33:20.500 -I found it incredibly hard to read. +NOTE Parsers -33:20.900 --> 33:22.740 -It doesn't have any diagrams. +31:03.240 --> 00:31:05.897 +Now let me talk about parsers -33:22.740 --> 33:24.420 -It has some examples, though. +00:31:05.898 --> 00:31:08.997 +and REPLs in a very strange place. -33:26.180 --> 33:34.420 -And the Lua wiki has a big page called LPEG tutorial with lots of examples. +00:31:08.998 --> 00:31:15.148 +I mean, using REPLs to build parsers step by step -33:35.700 --> 33:42.020 -But it also doesn't have diagrams, and I found some things incredibly hard to understand. +00:31:15.149 --> 00:31:20.438 +and replacing parts by more complex parts. -33:42.020 --> 33:48.500 -For example, this is something that is in the manual of LPEG that I saw and I thought, +00:31:20.439 --> 00:31:24.492 +I said that Lua is very minimalistic, -33:49.460 --> 33:53.060 -wow, great, this makes all sense, and this is going to be very useful. +00:31:24.493 --> 00:31:26.964 +and everybody knows that -33:53.060 --> 33:57.300 -It's a way to build grammars that can be recursive, +00:31:26.965 --> 00:31:30.720 +implementations of regular expressions -33:57.300 --> 34:02.020 -and they sort of can encode BNF grammars. +31:30.720 --> 00:31:33.973 +are big and complex. So instead of coming -34:02.020 --> 34:06.980 -We just have to translate the BNF a bit to get rid of some recursions +00:31:33.974 --> 00:31:36.375 +with full regular expressions, -34:06.980 --> 34:08.820 -and to translate them to something else. +00:31:36.376 --> 00:31:41.320 +Lua comes with something called patterns -34:10.580 --> 34:13.620 -And the manual also has some things that I thought, +00:31:41.321 --> 00:31:46.627 +and a library function called string.match. -34:13.620 --> 34:16.580 -oh, no, I don't have any idea of what this thing does. +00:31:46.628 --> 00:31:50.820 +Here is a copy of the part of the manual -34:17.380 --> 34:22.020 -And in fact, I saw these things for the first time more than 10 years ago, +00:31:50.821 --> 00:31:55.728 +that explains a part of the syntax of patterns. -34:22.020 --> 34:26.020 -and they only started to make sense one year ago. +00:31:55.729 --> 00:32:00.090 +Here's how string.match is described in the manual. -34:28.420 --> 34:30.340 -One example is group captures. +00:32:00.091 --> 00:32:04.536 +It's just this: looks for the first match of pattern -34:33.380 --> 34:37.620 -LPEG also comes with a module called the RE module. +00:32:04.537 --> 00:32:06.545 +in the string s, blah blah blah. -34:37.620 --> 34:40.180 -Let me pronounce it in Portuguese, the RE module. +00:32:06.546 --> 00:32:10.076 +Then we have to go to the other section of the manual -34:40.660 --> 34:45.540 -And its manual says, the RE module provided by the file repo.luen +00:32:10.077 --> 00:32:18.197 +that explains patterns. Lua patterns are so simple, -34:45.540 --> 34:48.100 -in the distribution supports a somewhat conventional +00:32:18.198 --> 00:32:23.221 +so limited, that they don't even have -34:48.980 --> 34:54.420 -regular expression syntax for pattern usage within LPEG. +00:32:23.222 --> 00:32:26.658 +the alternation operator. -34:55.140 --> 34:57.460 -And this is a quick reference. +00:32:26.659 --> 00:32:33.135 +Here is how it is described in the elisp manual, -35:00.500 --> 35:02.820 -And this thing is very brief. +00:32:33.136 --> 00:32:39.677 +`\|` specifies an alternative, blah blah blah. -35:02.820 --> 35:06.420 -It has some nice examples, but it's hard to understand in a way. +00:32:39.678 --> 00:32:45.880 +When we want to build more complex regular expressions, -35:06.660 --> 35:12.500 -And here are some comments about my attempts to learn HerdotLua. +32:45.880 --> 00:32:48.365 +patterns, grammars, etc., -35:14.020 --> 35:15.220 -This is a class. +00:32:48.366 --> 00:32:52.668 +we have to use an external library for that. -35:15.220 --> 35:17.060 -In this case, it's a very small class. +00:32:52.669 --> 00:32:56.207 +No, sorry, a library that is external, -35:18.180 --> 35:21.940 -And this file implements a PM method. +00:32:56.208 --> 00:33:01.471 +but that was written by one of the authors of Lua itself. -35:23.540 --> 35:26.980 -I'm going to show examples of other PM methods very soon. +00:33:01.472 --> 00:33:03.943 +This library is called Lpeg. -35:28.020 --> 35:33.380 -So this is a PM method for HerdotLua that lets us compare the syntax +00:33:03.944 --> 00:33:06.330 +Its manual says Lpeg is -35:33.620 --> 35:39.460 -of Lua patterns, LPEG, and HerdotLua. +00:33:06.331 --> 00:33:09.653 +a new pattern matching library for Lua -35:41.620 --> 35:43.060 -See this example here. +00:33:09.654 --> 00:33:14.772 +based on parsing expression grammars (PEGs). -35:43.700 --> 35:49.940 -So if we run this, it loads my version of LPEG. +00:33:14.773 --> 00:33:17.780 +The manual is very terse. -35:50.660 --> 35:52.740 -No, sorry, my version of LPEG-REX. +00:33:17.781 --> 00:33:21.945 +I found it incredibly hard to read. -35:54.820 --> 36:00.180 -And it shows that when we apply the PM method to this Lua pattern, +00:33:21.946 --> 00:33:25.415 +it doesn't have any diagrams. -36:00.740 --> 36:07.380 -this LPEG pattern, and this RE pattern, they all get the same results. +00:33:25.416 --> 00:33:28.769 +It has some examples, though. -36:07.380 --> 36:12.820 -So we can use this thing, this kind of thing here to show how to translate from +00:33:28.770 --> 00:33:34.016 +The Lua wiki has a big page called Lpeg Tutorial -36:14.420 --> 36:20.180 -Lua patterns that are familiar because they are similar to regular expressions, only weaker, +00:33:34.017 --> 00:33:39.560 +with lots of examples, but it also doesn't have diagrams. -36:22.260 --> 36:27.620 -to LPEG that is super weird, and to RE that is not so weird. +33:39.560 --> 00:33:43.131 +I found some things incredibly hard to understand. -36:28.580 --> 36:37.940 -Anyway, the comment says that in 2012, I had a project that needed a precedence parser that +00:33:43.132 --> 00:33:45.080 +For example, this is something -36:37.940 --> 36:42.900 -could parse arithmetical expressions with the right precedences. +33:45.080 --> 00:33:48.061 +that is in the manual of Lpeg that I saw, -36:44.580 --> 36:50.180 -And at that point, I was still struggling with pure LPEG, and I couldn't do much with it. +00:33:48.062 --> 00:33:51.480 +and I thought, wow, great, this makes all sense -36:50.180 --> 36:55.300 -So I tried to learn HerdotLua instead, and I wrote this old class here. +33:51.480 --> 00:33:53.946 +and this is going to be very useful. -36:56.260 --> 36:59.620 -That allowed me to use preprocessor on patterns for Lua. +00:33:53.947 --> 00:33:57.280 +It's a way to build grammars that can be recursive -36:59.620 --> 37:04.980 -And the thing is that with this preprocessor, I could specify precedence grammars using this +33:57.280 --> 00:34:01.300 +and they sort of can encode BNF grammars, -37:04.980 --> 37:12.900 -thing here that worked, but it was super clumsy, and I gave up after a few attempts. +00:34:01.301 --> 00:34:05.128 +we just have to translate the BNF a bit -37:14.900 --> 37:21.300 -And in 2022, I heard about something called LPEG-REX that was an +00:34:05.129 --> 00:34:07.592 +to get rid of some recursions -37:22.260 --> 37:28.740 -a kind of extension of Re, and it was much more powerful than HerdotLua, but after a while, +00:34:07.593 --> 00:34:10.959 +and to translate them to something else. -37:28.740 --> 37:32.660 -I realized that it had the same defects as HerdotLua. +00:34:10.960 --> 00:34:14.337 +The manual also has some things that I thought, -37:32.660 --> 37:41.620 -And let me explain that because it has all to do with the things about black boxes and magic +00:34:14.338 --> 00:34:17.845 +oh no, I don't have any idea of what this thing does. -37:41.620 --> 37:42.980 -that I told in the beginning. +00:34:17.846 --> 00:34:20.768 +In fact, I saw these things for the first time -37:43.380 --> 37:50.100 -Both, I mean, sorry, neither HerdotLua or LPEG-REX had some features that I needed. +00:34:20.769 --> 00:34:27.294 +more than 10 years ago, and they only started to make sense -37:51.620 --> 37:57.940 -They didn't let us explain, sorry, they received a pattern that was specified as a string, +00:34:27.295 --> 00:34:32.272 +one year ago. One example is group captures. -37:57.940 --> 38:04.740 -and it converted that into an LPEG pattern, but it didn't let us explore the LPEG patterns +00:34:32.273 --> 00:34:37.834 +Lpeg also comes with a module called the re module. -38:04.740 --> 38:05.540 -that it was using. +00:34:37.835 --> 00:34:43.182 +Let me pronounce it in Portuguese, the re module. -38:05.540 --> 38:12.900 -So I had to use the LPEG-REX, and it didn't let me explore the LPEG patterns that it was +00:34:43.183 --> 00:34:45.741 +Its manual says the re module -38:12.900 --> 38:13.540 -generated. +00:34:45.742 --> 00:34:49.503 +provided by the file re.lua in the distribution -38:16.420 --> 38:21.060 -Their code was written in a way that was REPL unfriendly. +00:34:49.504 --> 00:34:56.757 +supports some odd conventional regular expression syntax -38:21.060 --> 38:28.580 -I couldn't modify parts of the code bit by bit in a REPL and try to change the code +00:34:56.758 --> 00:35:04.520 +for pattern usage within lpeg. This is a quick reference. -38:29.700 --> 38:31.620 -without changing the original file, say. +35:04.520 --> 00:35:08.464 +This thing is very brief. It has some nice examples, -38:33.300 --> 38:37.220 -The code was very hard to explore, to hack, and to extend, in my opinion. +00:35:08.465 --> 00:35:11.120 +but it's hard to understand anyway. -38:37.780 --> 38:39.700 -The documentation was not very clear. +35:11.120 --> 00:35:14.180 +Here are some comments about -38:40.580 --> 38:50.660 -And I sent one or two messages to the developer of LPEG-REX, and he was too busy to help me. +00:35:14.181 --> 00:35:18.631 +my attempts to learn re.lua. This is a class. -38:50.660 --> 38:55.460 -He answered very briefly, and to be honest, I felt rejected. +00:35:18.632 --> 00:35:22.361 +In this case, it's a very small class. -38:55.460 --> 38:58.580 -I felt that I wasn't doing anything interesting. +00:35:22.362 --> 00:35:26.091 +This file implements a `pm` method. -38:58.580 --> 38:59.380 -Whatever, whatever. +00:35:26.092 --> 00:35:31.400 +I'm going to show examples of other `pm` methods very soon. -39:00.340 --> 39:11.940 -So, in 2022, I was trying to learn LPEG-REX, because I was thinking that it would solve +00:35:31.401 --> 00:35:34.696 +So this is a `pm` method for re.lua -39:11.940 --> 39:13.780 -my problems, but it didn't. +00:35:34.697 --> 00:35:40.301 +that lets us compare the syntax of lua patterns, lpeg, -39:14.500 --> 39:20.900 -It didn't have the features that I needed, and it was hard to extend, and hard to explore, +00:35:40.302 --> 00:35:46.631 +and re. See this example here. If we run this, -39:20.900 --> 39:22.100 -and hard to debug. +00:35:46.632 --> 00:35:51.379 +it loads my version of lpeg, no sorry, -39:22.980 --> 39:32.420 -I decided to rewrite it in a more hacker-friendly way, in the sense that it was modular, and +00:35:51.380 --> 00:35:56.013 +my version of lpegrex. It shows that -39:32.420 --> 39:35.460 -I could replace any part of the module from a REPL. +00:35:56.014 --> 00:36:01.552 +when we apply the `pm` method to this Lua pattern, -39:37.300 --> 39:48.340 -My version of it was called lpeg1.lua, and I decided that in my version, I wouldn't have +00:36:01.553 --> 00:36:05.960 +this lpeg pattern, and this re pattern, -39:49.060 --> 39:55.460 -the part that receives a grammar specified as a string and converts that to LPEG. +36:05.960 --> 00:36:08.238 +they all give the same results. -39:55.460 --> 40:03.780 -I would just have the backend part that are the functions in LPEG that let us specify +00:36:08.239 --> 00:36:11.512 +So we can use this kind of thing here to show -40:04.340 --> 40:05.380 -powerful grammars. +00:36:11.513 --> 00:36:15.588 +how to translate from Lua patterns that are familiar -40:10.340 --> 40:11.540 -So, let me go back. +00:36:15.589 --> 00:36:19.280 +because they are similar to regular expressions, -40:12.260 --> 40:14.260 -Let me explain a bit about LPEG. +36:19.280 --> 00:36:25.251 +only weaker, to lpeg that is super weird, -40:14.900 --> 40:16.180 -Lua has coercions. +00:36:25.252 --> 00:36:30.084 +and to re that is not so weird. -40:18.660 --> 40:22.740 -The plus expects to receive two numbers. +00:36:30.085 --> 00:36:35.425 +Anyway, the comment says that in 2012, I had a project -40:22.740 --> 40:29.860 -If one of its arguments, or both of them, are strings, it converts the strings to numbers. +00:36:35.426 --> 00:36:38.590 +that needed a precedence parser -40:29.860 --> 40:39.220 -So, in this case here, 2 plus string 3 returns the number 5, and this is the concatenation +00:36:38.591 --> 00:36:42.277 +that could parse arithmetical expressions -40:39.220 --> 40:39.860 -operator. +00:36:42.278 --> 00:36:46.314 +with the right precedences. At that point -40:40.820 --> 40:42.820 -It expects to receive strings. +00:36:46.315 --> 00:36:49.031 +I was still struggling with pure lpeg -40:43.780 --> 40:49.860 -So, in this case, it will convert the number 2 to the string 2, and the concatenation of +00:36:49.032 --> 00:36:51.318 +and I couldn't do much with it, -40:49.860 --> 40:51.700 -these two things will be 23. +00:36:51.319 --> 00:36:54.576 +so I tried to learn re.lua instead, -40:52.420 --> 40:54.420 -Sorry, 23 as a string. +00:36:54.577 --> 00:36:59.291 +and I wrote this old class here that allowed me to use -40:56.260 --> 40:58.420 -LPEG also has some coercions. +00:36:59.292 --> 00:37:01.755 +a preprocessor on patterns for Lua. -41:00.260 --> 41:09.620 -I usually set these globals to let me write my grammars in a very compact way. +00:37:01.756 --> 00:37:04.834 +The thing is that with this preprocessor -41:10.260 --> 41:17.460 -So, instead of lpeg.p, lpeg.c, etc., I use these globals like uppercase B, uppercase +00:37:04.835 --> 00:37:10.920 +I could specify precedence grammars using this thing here -41:17.460 --> 41:18.420 -C, and so on. +00:37:10.921 --> 00:37:14.488 +that worked but was super clumsy, -41:19.540 --> 41:27.540 -And with these globals, I can write things like this, c1 times string underscore. +00:37:14.489 --> 00:37:18.160 +and I gave up after a few attempts. -41:28.420 --> 41:40.820 -And LPEG knows that lpeg.c, sorry, it sort of expands these to lpeg.c, but lpeg.c expects +37:18.160 --> 00:37:25.632 +And in 2022 I heard about something called lpegrex -41:40.820 --> 41:47.380 -to receive an LPEG pattern, and one is not yet an LPEG pattern, so it is coerced into +00:37:25.633 --> 00:37:30.760 +that was a kind of extension of re, -41:47.380 --> 41:50.900 -an LPEG pattern by calling lpeg.p. +37:30.760 --> 00:37:33.045 +and it was much more powerful than re.lua, -41:51.220 --> 42:02.740 -So, this shorting here becomes equivalent to lpeg.c, lpeg.p1, and the multiplication, +00:37:33.046 --> 00:37:35.784 +but after a while I realized that -42:02.740 --> 42:09.940 -when at least one of its arguments is an LPEG pattern, it expects to receive two LPEG patterns, +00:37:35.785 --> 00:37:38.765 +it had the same defects as re.lua. -42:09.940 --> 42:15.700 -and in this case, the one at the right is just a string, so it is coerced to an LPEG +00:37:38.766 --> 00:37:40.698 +Let me explain that, -42:15.700 --> 42:17.620 -pattern by using lpeg.p. +00:37:40.699 --> 00:37:43.920 +because it has all to do with the things -42:18.180 --> 42:22.180 -With this idea, we can sort of understand this comparison here. +37:43.920 --> 00:37:52.026 +about black boxes and magic that I told in the beginning. -42:22.900 --> 42:24.980 -I mean, let me run it again. +00:37:52.027 --> 00:37:59.046 +Neither re.lua or lpegrex had some features that I needed. -42:24.980 --> 42:33.620 -This first part is very similar to a regular expression here at the left, and when we apply +00:37:59.047 --> 00:38:05.374 +They received a pattern that was specified as a string -42:33.620 --> 42:45.940 -this LPEG, sorry, this Lua pattern to this subject here, the result is that the Lua pattern +00:38:05.375 --> 00:38:08.868 +and it converted that into an lpeg pattern, -42:46.740 --> 42:53.540 -the result is this thing here, this thing, this thing, and this thing. +00:38:08.869 --> 00:38:12.520 +but it didn't let us explore the lpeg patterns -42:53.540 --> 43:00.580 -I'm going to call each one of these results captures, so each of these things between +38:12.520 --> 00:38:14.529 +that it generated. -43:00.580 --> 43:08.020 -parentheses captures a substring of the original string, and these captured substrings are +00:38:14.530 --> 00:38:20.662 +Their code was written in a way that was REPL-unfriendly. -43:08.020 --> 43:09.460 -returned in a certain order. +00:38:20.663 --> 00:38:26.281 +I couldn't modify parts of the code bit by bit in a REPL -43:10.420 --> 43:12.740 -Here is how to express the same thing in LPEG. +00:38:26.282 --> 00:38:28.943 +and try to change the code -43:13.540 --> 43:22.660 -It's very cryptic, but it's a good way to understand some basic operators of LPEG. +00:38:28.944 --> 00:38:32.035 +without changing the original file, say. -43:22.660 --> 43:34.900 -I mean, we can look at the menu and understand what C, S, and R do, and also exponentiation. +00:38:32.036 --> 00:38:35.353 +The code was very hard to explore, to hack, -43:35.860 --> 43:43.060 -And this strange thing here receives this string here, runs a function that I have defined +00:38:35.354 --> 00:38:38.238 +and to extend in my opinion. -43:43.060 --> 43:50.260 -that converts it to an object of a certain class, and that class represents He patterns. +00:38:38.239 --> 00:38:42.018 +The documentation was not very clear, -43:50.260 --> 43:56.900 -So this thing is treated as a pattern for He.Lua, and it is matched against the string, +00:38:42.019 --> 00:38:45.600 +and I sent wonderful messages to the -43:56.900 --> 43:59.300 -and it returns the same thing as the other one. +38:45.600 --> 00:38:51.013 +developer of lpegrex, and he was too busy to help me. -43:59.860 --> 44:06.260 -Also, this thing here also has a comparison with LPEG-REGS, but these patterns are very +00:38:51.014 --> 00:38:57.210 +He answered very briefly. To be honest, I felt rejected. -44:06.260 --> 44:06.820 -trivial. +00:38:57.211 --> 00:39:03.200 +I felt that I wasn't doing anything interesting, whatever. -44:06.820 --> 44:10.180 -They don't do anything very strange. +NOTE ELpeg1.lua -44:10.180 --> 44:14.260 -So let's go back and see what kinds of very strange things there are. +39:03.200 --> 00:39:07.470 +So in 2022, I was trying to learn lpegrex -44:16.660 --> 44:23.620 -Here is the page of LPEG-REGS at GitHub. +00:39:07.471 --> 00:39:13.200 +because I was thinking that it would solve my problems, -44:24.260 --> 44:25.860 -Here's the documentation. +39:13.200 --> 00:39:16.666 +but it didn't. It didn't have the features that I needed, -44:27.940 --> 44:29.380 -It's relatively brief. +00:39:16.667 --> 00:39:18.400 +and it was hard to extend and -44:29.380 --> 44:35.300 -It explains LPEG-REGS as being an extension of He.Lua. +39:18.400 --> 00:39:22.302 +how to explore and hard to debug. -44:36.500 --> 44:40.100 -So it explains mainly the additional features. +00:39:22.303 --> 00:39:28.960 +I decided to rewrite it in a more hacker-friendly way, -44:40.100 --> 44:44.180 -Here is a quick reference that explains only the additional features. +39:28.960 --> 00:39:32.035 +in the sense that it was modular -44:46.820 --> 44:53.380 -Some of these things I was able to understand by using the LPEG-REGS. +00:39:32.036 --> 00:39:37.160 +and I could replace any part of the module from a REPL. -44:54.340 --> 45:02.820 -I was struggling a lot, and some I wasn't able to, even by spending several evenings +39:37.160 --> 00:39:42.640 +My version of it was called ELpeg1.lua. -45:02.820 --> 45:04.420 -trying to build examples. +00:39:42.641 --> 00:39:48.120 +I decided that in my version I wouldn't -45:08.260 --> 45:10.900 -And this is something very nice. +39:48.120 --> 00:39:51.240 +have the part that receives a grammar -45:12.100 --> 45:19.700 -LPEG-REGS comes with some example parsers, and here is a parser that parses the Lua grammar. +00:39:51.241 --> 00:39:55.265 +specified as a string and converts that to lpeg. -45:19.700 --> 45:28.100 -I mean, this is the grammar for Lua 5.4 at the end of the reference manual. +00:39:55.266 --> 00:39:58.984 +I would just have the backend part -45:28.660 --> 45:35.860 -It's just this, and this is a kind of the BNF, and this is the BNF translated to +00:39:58.985 --> 00:40:02.171 +that are the functions in lpeg -45:37.300 --> 45:39.860 -the language of LPEG-REGS. +00:40:02.172 --> 00:40:06.320 +that let us specify powerful grammars. -45:40.420 --> 45:47.300 -So this thing uses many constructions that are in He.Lua and some extra constructions +40:06.320 --> 00:40:15.161 +Let me go back. Let me explain a bit about lpeg. -45:47.300 --> 45:49.460 -that are described here. +00:40:15.162 --> 00:40:20.780 +Lua has coercions. The `+` expects to receive two numbers. -45:50.260 --> 45:58.980 -And with these examples, I was able to understand some of these things here that are described +00:40:20.781 --> 00:40:25.930 +If one of its arguments or both of them are strings, -45:58.980 --> 46:02.660 -here in the quick reference, but not all. +00:40:25.931 --> 00:40:30.116 +it converts the strings to numbers. -46:06.660 --> 46:15.300 -So I wasn't able to use LPEG-REGS by itself because some things didn't make much sense, +00:40:30.117 --> 00:40:37.091 +So in this case here, `2 + "3"` returns the number 5. -46:15.300 --> 46:18.900 -and I decided to reimplement it in my own style. +00:40:37.092 --> 00:40:40.440 +This is the concatenation operator. -46:20.900 --> 46:27.860 -Because that would be a way to map, at the very least, map what I understood and what +00:40:40.441 --> 00:40:44.960 +It expects to receive strings. In this case, it will -46:27.860 --> 46:32.980 -I didn't, and learn one feature at a time, do comparisons, and so on. +40:44.960 --> 00:40:47.541 +convert the number 2 to the string "2" -46:35.380 --> 46:38.900 -Here, I pointed to two features of LPEG. +00:40:47.542 --> 00:40:50.960 +and the concatenation of these two things will be -46:38.900 --> 46:44.820 -One, I said, oh great, this thing can be used to define grammars, even recursive +40:50.960 --> 00:40:55.917 +"23". Oops, sorry, "23" as a string. -46:44.900 --> 46:46.020 -grammars, and so on. +00:40:55.918 --> 00:41:04.480 +lpeg also has some coercions. I usually set these globals -46:46.740 --> 46:52.820 -And this is an oh-no feature, one thing that didn't make any sense at all, group captures. +41:04.480 --> 00:41:10.013 +to let me write my grammars in a very compact way. -46:55.380 --> 47:01.620 -One thing that I did to understand group captures was to represent them as diagrams. +00:41:10.014 --> 00:41:13.811 +So instead of lpeg.B, lpeg.C, etc. -47:01.620 --> 47:08.020 -Of course, in the beginning, I was drawing these diagrams by hand, but then I realized +00:41:13.812 --> 00:41:17.878 +I use globals like B, C, and so on. -47:08.020 --> 47:15.220 -that I could use the bits of LPEG that I already knew to build a grammar that would +00:41:17.879 --> 00:41:21.720 +And with these globals I can write -47:15.220 --> 47:19.380 -parse a little language and generate these diagrams in LaTeX. +41:21.720 --> 00:41:36.047 +things like this, `C(1) * "_"`. And lpeg knows that lpeg.C, -47:20.340 --> 47:21.940 -And I was able to make this. +00:41:36.048 --> 00:41:41.147 +sorry, it sort of expands these to lpeg.C, -47:24.180 --> 47:34.500 -In this diagram here, this thing above the arrow is a piece of Lua code that specifies +00:41:41.148 --> 00:41:43.590 +but lpeg.C expects to receive an lpeg pattern -47:34.500 --> 47:36.100 -an LPEG pattern. +00:41:43.591 --> 00:41:48.547 +and 1 is not yet an lpeg pattern. -47:36.820 --> 47:43.540 -This thing here at the top is the string that is being matched, and the things below the +00:41:48.548 --> 00:41:53.347 +So it is coerced into an lpeg pattern by calling lpeg.P. -47:43.540 --> 47:51.220 -under braces are the captures that each thing, sorry, each thing captures. +00:41:53.348 --> 00:42:02.481 +So this short thing here becomes equivalent to -47:54.580 --> 48:02.100 -And for example, this under brace here corresponds to this pattern here that parses a single +00:42:02.482 --> 00:42:07.200 +`lpeg.C(lpeg.P(1))`. And the multiplication when at least one of -48:02.100 --> 48:05.060 -character but doesn't return any captures. +42:07.200 --> 42:13.320 +its arguments is an lpeg pattern, it expects to receive two lpeg patterns. And in this -48:05.140 --> 48:10.420 -This thing here parses a single B and doesn't return any captures. +42:13.320 --> 42:19.200 +case the one at the right is just a string, so it is coerced to an lpeg pattern by using -48:10.420 --> 48:16.740 -This thing here parses a single character and captures it, and this thing here parses +42:19.200 --> 42:29.360 +lpeg.P. With this idea we can sort of understand this comparison here. I mean, let me run it -48:17.620 --> 48:19.700 -the character D and captures it. +42:29.360 --> 42:37.440 +again. This first part is very similar to a regular expression here at the left. And -48:20.340 --> 48:29.220 -And this other thing here that transforms this pattern into another pattern returns +42:37.440 --> 42:51.440 +when we apply this lpeg, sorry, this lua pattern to this subject here, the result is this thing -48:29.780 --> 48:36.500 -first a capture with all the string that was parsed by this pattern here, and then all +42:51.440 --> 42:56.040 +here, this thing, this thing and this thing. I'm going to call each one of these results -48:36.500 --> 48:41.380 -the captures returned by this thing here before the column. +42:56.040 --> 43:04.080 +captures. So each of these things between parentheses captures a substring of the original -48:43.380 --> 48:50.900 -So this was a way to build concrete examples for things that the LPEG manual was explaining +43:04.080 --> 43:11.520 +string and these captured substrings are returned in a certain order. Here is how to express -48:50.900 --> 48:53.940 -in a very terse way, and it worked for me. +43:11.520 --> 43:20.720 +the same thing in lpeg. It's very cryptic, but it's a good way to understand some basic -48:54.740 --> 49:01.540 -Some things that were very mysterious started to make sense, and I started to have intelligent +43:20.720 --> 43:29.880 +operators of lpeg. I mean, we can look at the menu and understand what C, S and R do -49:01.540 --> 49:03.300 -questions to ask in the mailing list. +43:29.880 --> 43:41.360 +and also exponentiation. And this strange thing here receives this string here, runs -49:07.700 --> 49:16.980 -And with that, I was able to understand what are group captures and group captures that +43:41.360 --> 43:46.760 +a function that I have defined that converts it to an object of a certain class and that -49:16.980 --> 49:17.860 -receive a name. +43:46.760 --> 43:55.240 +class represents re patterns. So this thing is treated as a pattern for re.lua and it -49:20.900 --> 49:23.140 -Well, let me explain what this does. +43:55.240 --> 44:04.040 +is matched again the string and it returns the same thing as the other one. Also this -49:23.220 --> 49:30.180 -This thing here captures, sorry, parses the empty string and returns this as a constant. +44:04.040 --> 44:10.680 +thing here also has a comparison with lpeg.rex, but these patterns are very, very trivial. -49:30.180 --> 49:35.860 -So this is something that doesn't exist in regular expressions. +44:10.680 --> 44:17.340 +They don't do anything very strange. So let's go back and see what kinds of very strange -49:36.980 --> 49:40.180 -It parses nothing and returns this as a capture. +44:17.340 --> 44:31.480 +things there are. Here is the page of lpeg.rex at GitHub. Here is the documentation. It's -49:40.820 --> 49:48.580 -Then this thing here returns these two constants here and parses the empty string, and this +44:31.480 --> 44:39.120 +relatively brief. It explains lpeg.rex as being an extension of re.lua. So -49:48.660 --> 49:56.500 -thing here, d, converts the results of this thing here into a group capture and stores +44:39.120 --> 44:44.880 +it explains mainly the additional features. Here is a quick reference that explains only -49:56.500 --> 49:58.020 -it in the label d. +44:44.880 --> 44:56.840 +the additional features. Some of these things I was able to understand by struggling a lot, -50:01.380 --> 50:03.860 -And then here's another constant capture. +44:56.840 --> 45:08.720 +and some I wasn't able to even by spending several evenings trying to build examples. -50:03.860 --> 50:11.460 -And I realized that these things here were similar to how Lua specifies building lists. +45:08.720 --> 45:16.600 +This is something very nice. lpeg.rex comes with some example parsers. Here is -50:11.780 --> 50:16.580 -When we build, sorry, a table, when we build a table and we say that the first element +45:16.600 --> 45:25.720 +a parser that parses the lua grammar. I mean, this is the grammar for lua 5.4 at the end -50:16.580 --> 50:20.420 -of the table is here, this element is put at the end of the table. +45:25.720 --> 45:35.080 +of the reference manual. It's just this. And this is a kind of BNF, and this is the BNF -50:21.140 --> 50:30.820 -When after that we say d equals to, say, 42, we are putting the 42 in the slot whose key +45:35.080 --> 45:43.840 +translated to the language of lpeg.rex. This thing uses many constructions that are -50:30.820 --> 50:31.380 -is d. +45:43.840 --> 45:51.840 +in re.lua and some extra constructions that are described here. With these examples, -50:33.380 --> 50:37.860 -This was happening with LPEG captures, but there was something very strange. +45:51.840 --> 46:00.280 +I was able to understand some of these things here that are described here in the quick -50:37.860 --> 50:46.260 -These group captures could hold more than one capture, more than one value. +46:00.280 --> 46:13.840 +reference, but not all. So I wasn't able to use lpeg.rex by itself because some things -50:46.260 --> 50:50.340 -So there was something between lists and tables. +46:13.840 --> 46:21.560 +didn't make much sense. I decided to re implement it in my own style because that -50:51.300 --> 51:00.740 -I started to use this notation to explain in my notation what they were doing. +46:21.560 --> 46:29.120 +would be a way to map... at the very least, map what I understood and what I didn't and -51:02.340 --> 51:04.900 -Many things start, things stop. +46:29.120 --> 46:38.160 +learn one feature at a time, do comparisons and so on. Here I pointed to two features -51:05.220 --> 51:08.900 -Many things start, things started to make sense. +46:38.160 --> 46:44.880 +of lpeg. One I said, oh great, this thing can be used to define grammars, even recursive -51:08.900 --> 51:14.420 -Many mysterious sentences in the manual started to make sense, but some didn't. +46:44.880 --> 46:52.260 +grammars and so on. And this is an "oh no" feature. One thing that didn't make any sense at all: -51:16.100 --> 51:25.060 -But at least I was able to send some intelligent questions to the mailing list, and the author +46:52.260 --> 47:01.760 +group captures. One thing that I did to understand group captures was to represent them as diagrams. -51:25.060 --> 51:27.540 -of Lua and LPEG answered some of them. +47:01.760 --> 47:08.200 +Of course in the beginning I was drawing these diagrams by hand, but then I realized that -51:29.700 --> 51:31.860 -He was not very happy about my questions. +47:08.200 --> 47:16.680 +I could use the bits of lpeg that I already knew to build a grammar that would parse a -51:32.020 --> 51:40.100 -He told me that those diagrams were a waste of time, that the manual was perfectly clear, +47:16.680 --> 47:24.400 +little language and generate these diagrams in LaTeX. I was able to make this. In -51:40.100 --> 51:42.900 -and so on, whatever. +47:24.400 --> 47:35.520 +this diagram here, this thing above the arrow is a piece of Lua code that specifies an lpeg -51:42.900 --> 51:51.620 -But I was able to, so it was weird, but I was able to understand lots of things from +47:35.520 --> 47:43.160 +pattern. This thing here at the top is the string that is being matched and the things -51:51.620 --> 51:52.340 -his answers. +47:43.160 --> 47:57.880 +below the under braces are the captures that each thing captures. For example, this under -51:53.940 --> 51:57.380 -So this is a copy of one of my messages. +47:57.880 --> 48:03.520 +brace here corresponds to this pattern here that parses a single character but doesn't -51:57.380 --> 51:59.300 -Then there's another one, another one. +48:03.520 --> 48:10.680 +return any captures. This thing here parses a single B and doesn't return any captures. -51:59.300 --> 52:04.580 -Some were the diagrams, then he complained about these diagrams. +48:10.680 --> 48:17.800 +This thing here parses a single character and captures it. And this thing here parses -52:04.580 --> 52:12.980 -He said that these things here that look like table constructions do not exist, whatever. +48:17.800 --> 48:24.920 +the character D and captures it. And this other thing here that transforms this pattern -52:15.380 --> 52:23.220 -Anyway, once I understood group captures, many features were very, very easy to understand, +48:24.920 --> 48:35.040 +into another pattern returns first a capture with all the string that was parsed by this -52:23.780 --> 52:28.260 -and I started to be able to use LPEG to build some very interesting things. +48:35.040 --> 48:44.000 +pattern here and then all the captures returned by this thing here before the column. So this -52:30.260 --> 52:36.340 -I was able to reproduce some of the features that I saw in LPEG-REX. +48:44.000 --> 48:51.840 +was a way to build concrete examples for things that the lpeg manual was explaining in a very -52:38.420 --> 52:40.980 -Remember that this, where is that? +48:51.840 --> 48:58.600 +terse way and it worked for me. Some things that were very mysterious started to make -52:42.420 --> 52:44.020 -This is a syntax of Lua. +48:58.600 --> 49:10.200 +sense and I started to have intelligent questions to ask in the mailing list. With that -52:45.860 --> 52:54.820 -Here, I was able to understand how these things here were translated to LPEG code, to LPEG +49:10.200 --> 49:22.040 +I was able to understand what are group captures that receive a name. Well, let me explain -52:54.820 --> 52:58.340 -patterns by using group captures in a certain way. +49:22.040 --> 49:30.400 +what this does. This thing here parses the empty string and returns this as a constant. -52:59.460 --> 53:05.060 -And I was able to implement them in lpeg1.lua. +49:30.400 --> 49:38.520 +So this is something that doesn't exist in regular expressions. It parses nothing and -53:06.340 --> 53:14.180 -And after some time, I was able to use lpeg1.lua to build grammars that were able to parse +49:38.520 --> 49:46.800 +returns this as a capture. Then this thing here returns two constants here and parses -53:17.300 --> 53:19.860 -arithmetical expressions with the right precedence. +49:46.800 --> 49:54.440 +the empty string. And this thing here, D, converts the results of this thing here into -53:19.860 --> 53:25.700 -And here's an example in which I built the grammar step by step, and I test the current +49:54.440 --> 50:04.160 +a group capture and stores it in the label D. And then here's another constant capture. -53:25.700 --> 53:29.300 -grammar, and I replace a bit, and then I test the new grammar, and so on. +NOTE Building lists -53:31.780 --> 53:38.580 -And you can see that the result is always a tree that is drawn in a nice two-dimensional way. +50:04.160 --> 50:15.560 +I realized that these things here were similar to how Lua specifies building lists. -53:42.580 --> 53:52.340 -At this point, these powers here are returned as a list, as an operation +50:15.560 --> 50:22.320 +When we build a table and we say that the first element of the table is here, this element -53:52.900 --> 53:56.260 -pow with several arguments here. +50:22.320 --> 50:30.600 +is put at the end of the table. After that we say D equals to say 42. We are putting -53:56.820 --> 54:04.820 -And then I apply a kind of parsing combinator here that transforms these trees into other trees. +50:30.600 --> 50:39.880 +the 42 in the slot whose key is D. This was happening with lpeg captures but there was -54:05.540 --> 54:14.180 -And with these combinators here, I can specify that the power is associative in a certain +50:39.880 --> 50:49.320 +something very strange. These group captures could hold more than one capture, more than -54:14.180 --> 54:20.340 -direction, the division is associative in another direction, the minus is associative, +50:49.320 --> 50:57.400 +one value. So there was something between lists and tables. I started to use this notation -54:20.420 --> 54:24.420 -so it uses the same direction as a division, and so on. +50:57.400 --> 51:09.840 +to explain in my notation what they were doing. Many things started to make sense, many mysterious -54:24.420 --> 54:26.020 -And they have the right precedences. +51:09.840 --> 51:20.480 +sentences in the manual started to make sense but some didn't. But at least I was able to -54:28.660 --> 54:30.020 -So here are the tests. +51:20.480 --> 51:26.960 +send some intelligent questions to the mailing list and the author of Lua and LPEG answered -54:33.700 --> 54:37.140 -So here's my file lpeg1.lua. +51:26.960 --> 51:35.920 +some of them. He was not very happy about my questions. He told me that those diagrams -54:37.140 --> 54:38.340 -It has several classes. +51:35.920 --> 51:47.280 +were a waste of time, the manual was perfectly clear and so on, whatever. So it was weird, -54:38.980 --> 54:42.980 -Each class has tests after it. +51:47.280 --> 51:56.440 +but I was able to understand lots of things from his answers. So this is a copy of one -54:43.940 --> 54:51.780 -I was able to implement something that lpeg-reqs has that's called keywords. +51:56.440 --> 52:02.040 +of my messages, then there's another one, another one, some of the diagrams. Then he -54:51.780 --> 54:56.980 -That's very useful for parsing programs in programming languages. +52:02.040 --> 52:10.080 +complained about these diagrams, he said that these things here that look like table constructions -54:56.980 --> 55:06.580 -I was able to implement something similar to the debugger, to the PEG debugger that lpeg uses, +52:10.080 --> 52:22.720 +do not exist, whatever. Anyway, once I understood group captures, many features were very easy -55:07.220 --> 55:12.740 -but I was frustrated by some limitations of that debugger, +52:22.720 --> 52:30.800 +to understand and I started to be able to use lpeg to build some very interesting things. -55:12.740 --> 55:16.180 -and I implemented my own that is much better. +52:30.800 --> 52:39.600 +I was able to reproduce some of the features that I saw in lpegrex. Remember that this -55:17.700 --> 55:23.860 -And let me show something else. +52:39.600 --> 52:53.400 +is a syntax of Lua. Here I was able to understand how these things here were translated to lpeg -55:23.860 --> 55:32.900 -I was able to translate a good part of the Lua parser here to lpeg1.lua. +52:53.400 --> 53:02.880 +code, to lpeg patterns by using group captures in a certain way. I was able to implement -55:33.700 --> 55:39.940 -I haven't finished yet, but I have most of the translation here. +53:02.880 --> 53:13.080 +them in ELpeg1.lua. after some time I was able to use ELpeg1.lua to build grammars that -55:43.140 --> 55:50.420 -And after having all that, I was able to build other grammars very quickly. +53:13.080 --> 53:21.080 +were able to parse arithmetical expressions with the right precedence. here's an example -55:51.380 --> 55:59.220 -Writing new parsers finally became fun, and here's one example that I showed in the beginning. +53:21.080 --> 53:26.920 +in which I built the grammar step by step and I test the current grammar and I replace -56:03.620 --> 56:11.220 -If I remember correctly, I took a figure from the Wikipedia. +53:26.920 --> 53:34.400 +a bit and then I test the new grammar and so on. You can see that the result is -56:11.220 --> 56:17.220 -I don't have its link now, but I specified a grammar that parses +53:34.400 --> 53:48.720 +always a tree that is drawn in a nice two dimensional way. At this point, these powers -56:18.500 --> 56:21.140 -exactly the example that appears in the Wikipedia. +53:48.720 --> 53:57.760 +here are returned as a list, as an operation power with several arguments here and then -56:21.140 --> 56:28.100 -So with my grammar, considering that the top-level entry is statement, +53:57.760 --> 54:05.560 +I apply a kind of parsing combinator here that transforms these trees into other trees -56:28.100 --> 56:36.900 -when I parse this string here, the result is this tree. +54:05.560 --> 54:14.200 +and with these combinators here I can specify that the power is associative in a certain -56:38.100 --> 56:41.780 -And I can do some operations on that. +54:14.200 --> 54:22.320 +direction, the division is associative in another direction, the minus uses the same -56:41.780 --> 56:45.780 -I can define how this thing is to be converted into LaTeX. +54:22.320 --> 54:29.520 +direction as a division and so on and they have the right precedences. So here are the -56:47.460 --> 56:51.700 -I can define other operations that convert trees into other trees. +54:29.520 --> 54:42.360 +tests. So here's my file ELpeg.lua, it has several classes. Each class has tests after -56:52.580 --> 56:54.980 -And here are some tests of these operations. +54:42.360 --> 54:52.040 +it. I was able to implement something that lpeg.rex has that's called keywords, that's -56:58.340 --> 57:00.660 -This is what I showed in the beginning. +54:52.040 --> 54:59.160 +very useful for parsing problems in programming languages. I was able to implement something -57:00.660 --> 57:04.100 -I'm not going to explain all the details of this thing now. +54:59.160 --> 55:10.640 +similar to the debugger, to the pack debugger that lpeg uses, but I was frustrated by some -57:07.460 --> 57:14.260 -This show converts this thing into LaTeX in the way specified by these instructions here. +55:10.640 --> 55:23.280 +limitations of the debugger and I implemented my own that is much better and let me show -57:15.380 --> 57:16.340 -Let's say that... +55:23.280 --> 55:33.800 +something else. I was able to translate a good part of the Lua parser here to lpeg1.lua. -57:19.540 --> 57:20.260 -Well, whatever. +55:33.800 --> 55:45.880 +I haven't finished yet but I have most of the translation here and after having all -57:22.740 --> 57:23.540 -Really, whatever. +55:45.880 --> 55:54.960 +that I was able to build other grammars very quickly. Writing new parsers finally became -57:24.020 --> 57:28.500 -And here's the result, the LaTeX result. +55:54.960 --> 56:08.560 +fun and here's one example that I showed in the beginning. If I remember correctly, I -57:34.900 --> 57:46.260 -And these diagrams here are generated by this file here that defines a simple grammar that parses +56:08.560 --> 56:15.680 +took a figure from the Wikipedia, I don't have its link now, but I specify a grammar -57:46.260 --> 57:53.460 -this thing here, and then LaTeX it in a certain way, and then also tests this thing. +56:15.680 --> 56:24.280 +that parses exactly the example that appears in the Wikipedia. So with my grammar, considering -57:54.100 --> 58:00.900 -To check if this code here, that is Lua code that generates an LPEG grammar, +56:24.280 --> 56:36.680 +that the top level entry is statement, when I parse this string here, the result is this -58:02.900 --> 58:08.740 -parses this subject here and returns the expected result. +56:36.680 --> 56:44.840 +tree and I can do some operations on that. I can define how this thing is to be converted -58:12.740 --> 58:15.140 -So this is the code that I wanted to show. +56:44.840 --> 56:53.400 +into LaTeX. I can define other operations that convert trees into other trees and here's -58:15.700 --> 58:21.700 -I wanted to show many more things, but I wasn't able to prepare them before the conference. +56:53.400 --> 57:01.760 +some tests of these operations. This is what I showed in the beginning. I'm not going to -58:22.580 --> 58:29.060 -And I hope that soon, for some value of soon, I'll be able to create +57:01.760 --> 57:10.480 +explain all the details of this thing now. This show converts this thing into LaTeX in -58:29.620 --> 58:37.060 -REPL-based tutorials for LPEG here and lpeg1.lua, where LPEG is something very famous. +57:10.480 --> 57:39.320 +the way specified by these instructions here. And here's the result, the LaTeX result. -58:37.060 --> 58:39.460 -Here is a module of LPEG. +57:39.320 --> 57:46.880 +These diagrams here are generated by this file here that defines a simple grammar that -58:40.500 --> 58:48.100 -I could also do something like this for LPEG-REX, and lpeg1.lua is the thing that I wrote, +57:46.880 --> 57:56.720 +parses this thing here and then LaTeX it in a certain way and also tests to check if this -58:48.820 --> 58:58.900 -the one that has tests in comments, and the tests usually generate trees, +57:56.720 --> 58:06.600 +code here that is Lua code that generates an lpeg grammar, parses this subject here, and -58:58.900 --> 59:00.900 -and sometimes they generate tag code. +58:06.600 --> 58:16.880 +returns the expected result. So this is the code that I wanted to show. I wanted to show -59:03.300 --> 59:04.420 -Yeah, so that's it. +58:16.880 --> 58:23.920 +many more things, but I wasn't able to prepare them before the conference. And I hope that -59:04.420 --> 59:07.860 -I wanted to present much more, but I wasn't able to prepare it. +58:23.920 --> 58:33.240 +soon, for some value of soon, I'll be able to create REPL based tutorials for LPG, G and -59:07.860 --> 59:08.660 -So sorry. +58:33.240 --> 58:42.080 +ELpeg1.Lua where Lpeg is something very famous. Here is a module of LPG. I could also do something -59:08.660 --> 59:09.140 -Thanks. +58:42.080 --> 58:55.600 +like this for ELpeg, and ELpeg1.lua is the thing that I wrote, the one that has tests in comments -59:09.140 --> 59:10.260 -Bye. +58:55.600 --> 59:04.920 +and the tests usually generate trees and sometimes they generate tag code. So that's it, I wanted +59:04.920 --> 59:26.040 +to present much more, but I wasn't able to prepare it. So sorry, thanks, bye! |