Skip to content

claco/tt.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to my bizarre attempt to use Template Toolkit templates with .NET. My ultimate goal is to turn this into a ViewEngine for ASP.NET MVC

Rather than writing my own parser/lexer, I'm attempting to use ANTLR as the Parser/Lexer grammer which outputs an AST. The AST is then translated into C# using StringBuilder as part of ANTLR itself. The resulting source is compiled and run.

I chose to use Lexer/Parser->AST->Template assuming that once the grammar is written, we can use the parser to ouput VB.NET or any other language using the appropriate templates.

I'm starting simple (GET/SET) and working may out from there. Something should be easy. Some things fill be harder (FILTER), and some things won't translate at all (PERL blocks).

P.S. I have no clue what I'm doing. Most of this stuff was way over my head when I started, but somehow I have some simple syntac working all the way through the process. :-)

WHAT'S WORKING?
  - implicit variable get [% variable %]
  - explicit variable get [% GET variable %]
  - variable fallback from Process(data) to Settings(variables)
  - implicit variable set [% variable = x %], where x is string, number, decimal
  - explicit variable set [% SET variable = x %], where x is string, number, decimal
  - set defaults [% DEFAULT variable = x %], where x is string, number, decimal
  - multiple defaults in one block
		[% DEFAULT
			foo = 1
			bar = 'baz'
			baz = 2.34
		%]
  - multiple sets in one block
		[% SET
			foo = 1
			bar = 'baz'
			baz = 2.34
		%]
  - basic if statement  [% IF variable %]  [% variable %]   [% END %]
  - basic foreach statment  [% FOREACH i IN variable %]   [% i %]   [% END %]

About

Template Toolkit for .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages