Turing full template engines

What template engines / template languages ​​are complete? I have heard about this so far:

  • FreeMarker (implemented in java)
  • MovableTypes template language (in perl)
  • xslt: - (
  • Cheetah (in Python)
  • Smarty (in PHP)

Any others (especially implemented with perl)?

Ps: Do not waste time explaining MVC to me and why gluing complete templates is bad, and why this is not a useful comparison point :)

+6
source share
4 answers

Perl Template :: Toolkit allows embedding Perl if the EVAL_PERL flag is set. Inside the template, the PERL and RAWPERL blocks allow us to briefly (in the case of RAWPERL) extend the internal elements, and the embedded code is evaluated using eval() (quoted eval). This provides full access to the Perl interpreter.

Perl itself is considered a Turing Complete grammar . Therefore, given that Template :: Toolkit does provide access to Perl itself, the template system inherits this characteristic.

Although setting EVAL_PERL to enable embedded Perl inside a template is considered an advanced (and supposedly rarely used) feature, it is available for the strong (and doubtful-reasonable).

+3
source

eRuby allows you to embed custom Ruby in your templates:

 $ echo "Hello <%= 'dlrow'.reverse() %> from eRuby" | erb Hello world from eRuby 
+3
source

Almost everything that allows the process code to calculate the result of the template.

0
source

Most metaprogramming languages support arbitrary evaluation and splicing of code in a running program. Thus, most support Turing-complete calculations as part of performing splices and substitutions.

On the other hand, simple meta-information systems of simple interpolation are usually very limited (for example, there is no recursion).

0
source

Source: https://habr.com/ru/post/890559/


All Articles