DEV Community

funcieqDEV
funcieqDEV

Posted on

Own programming language for SSG

I wrote my own programming language that allows for much more efficient and time-saving writing of static webistes. It is written in rust for maximum speed

Atra Because that's what we're talking about now. It's a programming language that compiles to html, but allows you to use components, has a C-like syntax, It has built functions like %loop(3){}

Simple page in Atra(more fomplex example https://github.com/funcieqDEV/Atra/tree/main/examples/atra_showcase)

text("<!DOCTYPE html>");
html(lang="en"){
    head(){
        meta(charset = "utf-8);
        title(){
            text("Document");
        }
    }
    body(){
        p(){
            text("Hello world");
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

the component system allows us to use code written once many times, so let's add a component to the previous code

$describe(What,Description){
    h3(){text("{What}";)}
    p(){text("{Desription}");}
}

text("<!DOCTYPE html>");
html(lang="en"){
    head(){
        meta(charset = "utf-8);
        title(){
            text("Document");
        }
    }
    body(){
        p(){
            text("Hello world");
        }

        %each("apple", "Orange", "Tomato" , "Tangerine"){
           $describe(item, "Small round and to the mouth");
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

As you can see, each component must start with $

Top comments (2)

Collapse
 
nathan_tarbert profile image
Nathan Tarbert

Pretty cool seeing you actually build your own language out, I always wonder what keeps someone going through all the tedious details on stuff like this.

Collapse
 
funcieqdev profile image
funcieqDEV

Thanks, Well it's not my first language so I have experience, But you have to predict all the characters that the programmer may enter and handle them appropriately., And then you need to check if the syntax is correct, Well, there is quite a bit of it

Some comments may only be visible to logged-in visitors. Sign in to view all comments.