Back to Blog

I built a programming language in Spanish

· telar compilers open source web development

A few days ago, I asked myself a question I couldn’t ignore:

Why do programming languages have to be in English?

It’s not a rhetorical question. It’s a real barrier for millions of people learning to code. And on top of that, modern web development has another problem: to build a simple app today, you need to choose from dozens of frameworks, configure webpack, write JSX, manage dependencies… all before you’ve solved the real problem.

So I started exploring an idea: what if you could describe what you want in Spanish, and the compiler made all the technical decisions for you?


The Idea

The result is called Telar — a declarative programming language for the web with structured Spanish syntax.

It’s not completely free Spanish. It’s a dialect with recognizable patterns that read like human language but are precise for a compiler. The difference is important: too free and the compiler guesses. Too strict and it loses naturalness.

This is a complete online store in Telar:

aplicación MiTienda

  página inicio en "/"
    título "Bienvenido"

    mostrar productos recientes
      máximo 8
      ordenados por precio
      si falla
        mostrar "Sin conexión"
        reintentar en 5 segundos

    si el usuario está conectado
      botón "Mi cuenta" ir a cuenta
    si no
      botón "Entrar" ir a login

    optimizar para móvil
    caché 10 minutos

That compiles to semantic HTML, responsive CSS, and optimized JavaScript. Without touching any of those files.


How It Works Under the Hood

A compiler has three phases. Each one transforms information into something more structured:

Lexer — reads the text character by character and produces tokens. página becomes [PAGINA], "Bienvenido" becomes [TEXTO: Bienvenido]. Here I learned that Spanish has peculiarities that English does not — accents, ñ, ¿, special characters. The first error I saw was an invisible Windows character (\r) that the lexer did not recognize.

Parser — takes those tokens and builds a tree. página inicio en "/" becomes a NodoPagina node with name, path, and children. Here is where the language logic is — what can go inside what, what is mandatory, what is optional.

Generator — traverses the tree and produces HTML. Each node has its template. NodoBoton with action ir generates an <a href>. With action hacer it generates a <button>.

The hardest part was not any of these three phases separately. It was the error system. I wanted Telar to never fail silently and for its messages to be truly useful:

✗  Línea 12: "máximo muchos" — se esperaba un número
   ¿Quisiste decir "máximo 10"?
   Sugerencia: los números van sin comillas en Telar

That’s infinitely better than TypeError: undefined is not a function.


What I Learned

Programming languages are design products. Every syntax decision has consequences. Is indentation significant or do we use braces? Are errors the compiler’s or the user’s? What happens when something fails in production? Every answer defines the character of the language.

The technical problem is the easiest. Building the compiler was difficult but achievable. The real problem is adoption — a language without users has no libraries, and without libraries, it has no users. It’s a vicious circle that only breaks with time, community, or backing from a large company.

Building in public has immediate value. Before having a single line of code, documenting the idea, principles, and syntax in a repository already generates conversation. The specification is as important as the code.


Where It Is Now

Telar is published on npm and works:

npm install -g @davidbc01/telar
telar servir app.telar

This is v0.1 — it generates static HTML and CSS from Telar code. v0.2 will add JavaScript for true interactivity. v1.0 will include a package manager, a VS Code extension and a community.

It is a personal project in its early stages. The syntax may change. But it already exists, and that is what matters right now.

If you find it interesting or have feedback, the repository is open and issues are welcome.

🔗 github.com/davidbc01/telar


The most valuable part of this project is not the compiler.
It is having demonstrated that the idea was possible.

The rest is iteration.