Answer the question
In order to leave comments, you need to log in
Who can advise the literature on syntax trees?
Good afternoon.
There is a self-written console tool with its own query language. There is a task: to write a script for creating requests to the tool in C#. I know how to make an ExpressionTree in C#, I can imagine how to write a syntax node in Roslyn. How to implement a similar mechanism for your own language?
Roughly speaking, there is a query "Get fullLine from storage Trash where Source is "Universe" and inputDate moreThan 2016-07-12".
You need a lib that allows you to generate queries in the form
of Query.New.
GetAll().From("Trash")
.Filter("Source", FilterType.Equal, "Universe")
.Filter("inputDate", FilterType.MoreThan, new DateTime(2016,7,12))
.Result;
If you manage to somehow screw in LINQ, it's generally gorgeous.
var query = Storage.Where(row => row.Source == "Universe")
.Where(row => row.inputDate > new DateTime(2016,7,12))
.ToList();
Where to dig? Will I need syntax trees to solve? If so, what literature would you recommend?
Answer the question
In order to leave comments, you need to log in
Will I need syntax trees to solve? If so, what literature would you recommend?
Linq uses extension methods. For example System.Linq.Enumerable. what hinders to write the methods extending?
https://ru.wikipedia.org/wiki/%D0%9E%D0%B1%D1%80%D...
Для наглядности расставим скобки
((Get fullLine) from (storage Trash)) where ((Source is "Universe") and (inputDate moreThan 2016-07-12))
Переводим в польскую
((fullLine Get) (Trash storage ) from ) ((Source "Universe" is) (inputDate 2016-07-12 moreThan ) and ) where
Полученная запись легко может быть преобразована в нужный код раскручиванием стека
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question