|
So I've been wracking my brain trying to come up with a code generator for something significant that hasn't already been done, or even done to death in .NET.
One of the reasons I wrote so many lexer generators and parser generators is because they weren't necessarily well covered territory in .NET, and besides aren't very well understood in general. As code generation tools go, these projects were worthy of effort.
But code generation tools for data layers, entity generators, and typed XML and JSON generators are well covered ground. I'm coming up empty thinking of another tool to add to the arsenal of available generators out there. My parsers and lexers notwithstanding, I can't think of much else to add. And I've jumped the parser shark anyway, with Glory, the GLR parser generator I built.
All of that having been said, I really would like to do some more code generation tools. I tried implementing a visitor generator but I ran into some implementation issues that aren't easily rectified as far as it chasing spurious properties (like SyncRoot on old collection classes) and not handling chained indexer expression properties. I've shelved it for now.
So now I'm looking for some ideas. They'll come eventually. I don't want to do anything that involves wholesale generation of HTML or even ASP.NET code and such, more just tools that spit out C# (and possibly VB.NET like my other generation projects)
Anyone have anything they know can/should be automated and is general enough that it's useable outside of a very specific task? We might be able to help each other.
Real programmers use butterflies
|
|
|
|
|
There might be room for some smart and speedy serializer that do not use reflection perhaps?
Although, with the upcoming and promising GRPC that might be a waste of time...
But i did write a reflection tool (that is version tolerant) and I used a lot of reflection there... But code generation might have been an alternative?
|
|
|
|
|
|
I think I mentioned this to you before, but I have a fascination with the visual salience of decision tree rule structures rendered into relatively simple ui's [^]
I like to give my students this example to test their logical thinking in terms of how they perceive what the most relevant criteria are:Quote: AIRFARE DISCOUNT from visual-paradigm's old website
Infant passengers under two years old are offered a discount of 80% on domestic flights.
Infant passengers under two years old are offered a discount of 70% on international flights.
Youth passengers (between two and sixteen) are offered a discount of 10%, for any kind of destination.
Passengers who make reservation five months before their journey are offered a discount of 10%.
For international flights, passengers are offered 15% discount if they travel during off-seasons.
There would be no discount for international flights, except that when the passenger is an infant passenger or when travelling during off-season.
Frequent flyer enjoys a discount of 15%.
The amount of discount is accumulated.
The maximum amount of discount for infant passengers is 80%
The maximum amount of discount for non-infant passengers is 20%. Now, some students immediately grok that "age" is the criteria here with the most "organizing power." Others don't have a clue.
The challenge I see is how to take a set of "rules" like this and "prune" the matrix of possible combinations down to the essential set.
In my head this also relates to the general area of "business rules," and even DSL's.
Hope you found this interesting; my head is not on very straight these daze.
cheers, Bill
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Coding a decision tree structure is one thing, but the problem I see with generating code for it is making it work in the general sense - a similar problem with state machines. As in, sure I can make one of these things, but it will be suitable toward one particular task - like your airfare example. I don't see a lot of opportunity to generalize the algorithm. As I said, I ran into the same problem with state machines.
Real programmers use butterflies
|
|
|
|
|
If you wanted to step into Python, I think there is a need for an extension similar to LINQ. I'd call it PINQ. (Python or Pandas language integrated query)
Python and its Pandas library is used heaps for data manipulation, but some of its syntax is very inelegant and cumbersome.
Most stuff is implemented as functions on pandas data frames, and joining two of them together is done as a function call.
pd.merge(left=first, right=second, how='left', left_on='first_field', right_on='second_field').drop('second_field', axis=1)
It's just really painful. It ought to be possible to define a cleansyntax that was far more expressive of common data manipulation on dataframes and translate into a series of pandas calls. It could be done as a pre-processor step prior to trying to merge into baseline Python.
It would be interesting to try to define this as an abstract and be able to translate into python/pandas code, LINQ, R, SQL, etc
|
|
|
|
|
I have not used python, primarily in protest of the fact that whitespace is significant in the language.
Real programmers use butterflies
|
|
|
|
|
lvalue.
|
|
|
|
|
Those of us who've been here long enough will remember Osmodian (I might have that name wrong) where he went on and on about English language to code generation. In many ways, I think that's still the Holy Grail - when I was 20 or so, at a computer convention in SF (think Apple ][, Commodore, Trash-80, Atari, Sinclair, etc) there were quite a few demonstrations of code being generated from sentences. It was touted as "this is the future".
Well, that future never happened.
|
|
|
|
|
To me, it's obvious that such a future isn't realistic, absent AI and the ability to "do what I mean" if only because of the ambiguous nature of human language.
Digital computers require precision. They are notoriously bad at dealing with ambiguity and to a lesser extent, non-determinism.
It makes me wonder why such engineers wasted their time. They should have perhaps consulted a linguist.
Actually, Noam Chomsky could have probably steered them straight.
Real programmers use butterflies
|
|
|
|
|
|
This is bad news for us space pirates
Real programmers use butterflies
|
|
|
|
|
Dire news, indeed!
|
|
|
|
|
Save us from US
that was so unfunny don't know which is worse for the world:
The truth and humor black hole of the USA media or the truth and morals black hole of the CCP?
(Yes political, AS WAS the OP)
|
|
|
|
|
Haha, moon dubloons
|
|
|
|
|
The two main adversaries of the US, Red China and Russia, have both demonstrated the ability to shoot down LEO satellites. The US is behind in this arena.
And no, I really don't like the idea of militarizing space, but I understand that human nature will require it.
|
|
|
|
|
Did you know that a deaf lip-reader (deprived of visual context) cannot distinguish between “elephant juice” and “I love you” ?
I learned this from my WordSmith word-o-the-day e-mail. The technical term for such parssing ambiguities is "homophene."
cheers, Bill
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
OMG! That explains a lot of misunderstanding!
|
|
|
|
|
BillWoodruff wrote: “elephant juice” and “I love you” ? In the CP context of the former, I can see the (not very KSS) connection. " " juice"
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
...but what are the odds you'll ever ask for a nice, tall, refreshing glass of elephant juice...?
|
|
|
|
|
|
Times change. Even when you have pointy hair: Meetings just got a lot more fun[^]
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
LOL! That is so funny
|
|
|
|
|
|
Yeah, and it's not wrong either. Mac users DO stink!
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
modified 27-May-20 3:22am.
|
|
|
|