LabLua in Google Summer of Code 2020
We were very happy to participate again in Google Summer of Code (GSoC)! This is the seventh time we had the opportunity to collaborate with students from all around the world on interesting projects. These are the highlights from the 2020 edition, in the student's own words.
- The Caribay parser generator — Gustavo Castellanos
- Configuration validator for LuaFormatter — Ankit Karan
- Extending the support of Céu in the Céu-Arduino IDE — Maged Rifaat
- Lua Hook on kTLS — Xinzhe Wang
- Lua states management for Lunatik — Matheus Silva Rodrigues
- Pallene to Lua Translator — Samuel Rowe
The Caribay parser generator — Gustavo Castellanos
For this project we created Caribay, a PEG (Parsing Expression Grammar) parser generator built with LpegLabel, with support of automatic generation of error labels and error recovery rules. The generated parser produces a generic abstract syntax tree or a list of thrown errors. Caribay makes easier to parse lexical symbols, comments, identifiers and keywords using its own syntax.
We developed a parser for the input grammar, a preprocessor for computing FIRST and FOLLOW sets, an algorithm for automatically generating error labels, optional optimizations which can be enabled by the user, and a translator that generates LPegLabel patterns.
A story about the name: Caribay is the daughter of Zuhé (the Sun) and Chía (the Moon) from a legend of the Mirripuyes (an indigenous group from Mérida, Venezuela). Since Lua means Moon in Portuguese, the tool being the daughter of Lua sounded nice to me. Also, the legend involves the origin of five famous peaks from Mérida, so the name is related to "generating" things.
The CodeCaribay can be installed using Luarocks. The source code has been published on Github.
The StudentGustavo Castellanos is a student of computer engineering at Universidad Simón Bolívar, Venezuela. He is interested in programming languages and learning new software engineering and computer science concepts.
Configuration validator for LuaFormatter — Ankit Karan
LuaFormatter is a code formatter for Lua scripts inspired by clang-format. It formats Lua scripts according to a user defined configuration file. Before this project, LuaFormatter didn't check if the configuration values made sense before using it. For example, following configuration was valid:
- column_limit : -5 - indent_width : -2 - single_quote_to_double_quote : true - double_quote_to_single_quote : trueIn this project, we implemented validators for each configuration field. We also had the opportunity to fix bugs and implement other features. You can find more information about what we did in this link.
The most exciting part for me was working with open-source around brilliant techies from all over the world. I learned a lot of things and improved my code workflow.
The CodeAnkit's work resulted in several pull requests, which were merged into the upstream LuaFormatter repository.
The StudentAnkit Karan is a tech-oriented person diving into the programming world to sort out the real-world problems with software-based solutions. He is from Bihar, India. Currently he is pursuing a B.Tech from Indian Institue of Technology, Mandi.
MentorsPedro Tammela and Shaobang Wen
Extending the support of Céu in the Céu-Arduino IDE — Maged RifaatComing Soon. Céu is a reactive programming language that provides a deterministic parallel execution model and aims to offer a higher-level and safer alternative to C. In this GSOC Project, we improved the support for the Céu language in the Arduino IDE, implementing support for opening code files, compiling and running/uploading scripts. We also added documentation and syntax features such as syntax highlighting, auto indentation and code folding.
The CodeThe code produced during this GSOC is available on Github.
The StudentMaged Rifaat is an engineering student from Egypt and a programming enthusiast who is always eager to learn more.
Lua Hook on kTLS — Xinzhe Wang
For this project, we added Lua hook support to the kTLS Linux kernel module. The goal is to combine kTLS with the flexibility of Lua to processs network requests inside the Linux kernel. By adding Lua hooks to kTLS, it is now possible to use Lua scripts to process network data inside the kernel, after it has been received and decrypted.
We also wrote a simple https server to measure the performance of the Lua hook. The server uses Lua scripts to parse the request and then uses the sendfile system call to send the static file back to the user. The performance was similar to that of the lighttpd web server, which is promising because the implementation of Lua hooks hasn't been fully optimized yet.
You can find more information about what we did this GSOC in this link.
The CodeThe code for the kernel module and the benchmark web server is available on Github
The StudentXinzhe Wang is an undergraduate student at Shanghai Jiao Tong University, majoring in Software Engineering. He enjoys geek culture and always tries new things. He hopes to change the world with code someday.
MentorsPedro Tammela and Victor Nogueira
Lua states management for Lunatik — Matheus Silva Rodrigues
In this project we added support for the Lunatik framework to manage Lua execution states inside the kernel. For this, we developed a kernel API that allows Lunatik bindings to create and access Lua execution states handling the synchronization with user space or other bindings. This includes a protocol over generic Netlink that allows creating and managing Lua states and loading Lua scripts from user space. We also also adapted both NFLua and XDPLua to use these facilities. More information can be found in this link.
The CodeThe code created during this GSOC project will be merged into the related upstream projects. There are three pull requests, one for Lunatik, one for XDPLua, and one for NFLua.
The StudentMatheus Rodrigues studies computer science student at Universidade Federal de Goiás (UFG). He loves to learn new things every day, especially if those things are related to computers.
MentorsLourival Vieira Neto and Victor Nogueira
Pallene to Lua Translator — Samuel Rowe
Pallene is a statically typed, ahead-of-time-compiled sister language to Lua, with a focus on performance. Programmers can use Pallene instead of C modules to improve the performance of their programs. Pallene achieves this by translating a statically typed compilation unit into a C source file, which is implicitly compiled in the background. In this project, we implemented several new Pallene features, including the dot notation for the built-in modules, the export keyword, and a Pallene to Lua translator (the new Lua backend). The documentation and unit tests for the same were also written.
We encountered many interesting challenges during the development. One of them is that when we were testing the validity of the translator we had to test both how the generated output looked and how it behaved at runtime. For the latter case, we managed to come up with an elegant design that allowed us to reuse existing unit tests. Thus, we were able to ensure that both the Lua and the C backends produce similar runtime behavior.
Google Summer of Code has been an amazing experience! I am really grateful to everyone at LabLua for providing me with this opportunity. I learned about collaborating with others, keeping up with schedules, code reviews, rebasing Git branches, writing unit tests with good coverage, and much more.
The CodeDuring this projects, several pull requests which were merged into the Pallene source code repository.
Samuel Rowe is from Bengaluru, India. He enjoys working on compilers and web applications. Someday he wants to start a company that thrives on innovation.
ಕಲಿಯೋಕೆ ನೂರು ಭಾಷೆ ಆಡೋಕೆ ಒಂದೇ ಭಾಷೆ ಕನ್ನಡ ಕನ್ನಡ ಕಸ್ತೂರಿ ಕನ್ನಡ.