This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: Using GCC to convert markup to C++

Forwarding this to the gcc list, since it seems to be more releavant
to the topic of this list. Sorry for the confusion.

  Akos Vandra

---------- Forwarded message ----------
From: Akos Vandra <>
Date: 16 April 2014 12:48
Subject: Using GCC to convert markup to C++


We are developing a C++ Web Framework, and we use ERB for the markup
of the views.
I would like to use the GCC tool collection to convert that ERB markup
to C++ code that would actually do the rendering, so the markup
interpretation would happen at compile time.

How is that possible? Can you give me some pointers on what part of
the documentation I should read up on?

Is a frontend capable to generate C++ code? Is that the way this
should be solved? Or should I take another route?
The reason for using GCC would be its (presumed) capability of parsing
a language grammar extracting the tokens, which can be easily
translated into code afterwards.

  Akos Vandra

P.S. Something like:

<%#include <time> >
Hello ERB World!
You are the <%= count %>. visitor!
The current time is <%= strftime(time()) %>.


  #include "abstractview.h"
  #include "context.h"

  class MyView : public AbstractView {
    virtual void render(Context ctx);

#include "my_view.h"
#include <time>

void MyView::render(Context ctx) {
  std::string s;
  s.append("Hello ERB World!\n You are the ");
  s.append(". visitor!\n The current time is: ");

  return s;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]