DEV Community

Discussion on: Who's looking for open source contributors? (August 28 edition)

Collapse
 
lexplt profile image
Alexandre Plt

Hi !

I have started working on a programming language named Kafe a while ago, and I am searching for someone (or sometwo, somethree... you get the joke :p ) to help me in this project.

What is it ? a scripting language for video games.

Basically, a programmer will have to follow those steps to use Kafe code in his game/project :

  • code something in Kafe
  • compile it using kafec (the kafe code compiler)
  • add the generated bytecode file to his project
  • #include<kafe/vm/VM.hpp>, then create his/her Kafe VM, feed it with the filename of the bytecode file, and then execute it !

Syntax examples and goals

cls Character
    dyn name
    dyn life
    dyn weapon

    # comma in argument list is optional
    fun __init__(self name life)
        self.name = name
        self.life = life
        ret

    fun __add__(self other)
        self.life += other.life
        other.life = 0
        ret self.life

end

cst default_life = 110

dyn harry_potter = new Character("Harry Potter" default_life)
dyn voldemort = new Character("Voldemort" default_life)

# let's say this is to attack voldemort
# some kind of syntaxic sugar, somehow
harry_potter + voldemort

My ultimate (unachievable) goal is to replace Lua, because it lacks proper classes and arrays (imo).

A most affordable goal would be to be able to use Kafe with a minimal performances loss in video games.

Can we compile Kafe code without using kafec ?

No, we can't. The goal is to provide only the bytecode files because they are smaller, and it's a huge performance improvement for your game/project, since it's already compiled and you don't have to wait for it to be compiled before executing Kafe code.

How is the project structured ?

It is split in 7 or 8 projects :

C++:

  • the Kafe VM
  • the Kafe compiler using ANTLR
  • the plug-ins system (I will explain how it works below)
  • the Kafe (assembler) disassembler, to be able to read bytecode more easily. It will probably be helpful to compile "text bytecode" to bytecode (as nasm does for example)
  • cup, the package manager, to download plugins

HTML/CSS/JS:

  • the website of the project, hosting the documentation
  • the KEP (Kafe Enhancement Proposals, yes my imagination is very limited), similar to the PEP of Python part of the website : kafe-lang.github.io/kep.html

Python:

  • the tests suite (linked to cmake) for the VM, can easily be adapted for the compiler

The plug-ins

A plug-in must follow a specific pattern to be used by the Kafe VM, because it will compiled into a .dll/.so, and loaded at runtime by the VM. It will only have a 3 functions :

  • KafeVMversionRequired, to know the version of the VM used to create the plugin
  • PluginVersion, useful for debugging, and version tracking in the package manager cup
  • registerFunctionsAndObjects, to load C++ functions and Kafe classes definitions into the VM, to use them in Kafe code

Current progress

  • the website is done, just a bit empty
  • all the documentations are set up, I just need to complete them
  • I fixed a template for the KEP (to be able to convert them from Markdown to HTML for the website)
  • the Kafe Compiler is using ANTLR, so I just need a grammar (already have one, but I need to rewrite it), and a visitor (not done). The parser and lexer are done as well as the CLI
  • the Kafe VM is done by 90%. I still a bunch of things to do with the classes and plugins but I described everything in a book (I was on holydays the past 2 weeks)
  • I have templates for cup, Kafe ASM (the (assembler) disassembler), and the plugin-system (I already have something to load .dll/.so/.dynlib but I did not push it yet)
  • I also started a Kafe CLI, to be able to rule them all use cup/kafec/Kafe VM/Kafe ASM with only one program

You can join the project on Discord and/or follow it on GitHub !


Also, I started working on a 3D rendering lib using OpenGL : Zavtrak.

I want to create a library to do 3D rendering easily using OpenGL (currently 3.3.x) with a nearly zero cost abstraction.

Currently, I have utilities to play with the keyboard, the mouse, create a window and handle it more easily (using GLFW), play with VAO, VBO, EBO, vertices, and shaders.

The stack :

  • C++ 17
  • OpenGL 3.3
  • GLFW
  • glad

If want to have a look at it, the GitLab is here : gitlab.com/SuperFola/Zavtrak, and if you want to talk about, you can PM here (or on my twitter, or even on my discord : SuperFola#4234)

Have a good day guys !

Collapse
 
mandaputtra profile image
Manda Putra

I can help you with the websites

Collapse
 
lexplt profile image
Alexandre Plt

Hi ! Thanks for your reply, as for the websites, one would be needed for Zavtrak but none for Kafe, since I am using a template (and writing documentation to markdown converted to html later).

We can talk about that in PM ?

Thread Thread
 
mandaputtra profile image
Manda Putra • Edited

seems like I miss your reply, sorry about that I've been busy of my work. You can contact me on discord mandaputtra#8332