The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
I should have come back earlier - I am impressed. I am not knocking your generator; keep it up, because it looks good to me.
As an actual human being I would try to avoid something that looked like that (reformat the code at minimum). Because the first thing I would do with that code is reformat it into something that a human can read without counting braces (brackets or whatever). "Trust, but verify".
There was a time when that whole 'if' statement would be one step in a debugger. You had to stop and look at every variable to figure out why it passed or failed. That is why some modern compilers (VS) allow you to actually step through the individual sub-statements in the 'if' statements. Why that was the case has to do with the language itself, which I cannot explain at the moment.
I got carried away again. In theory, if not in practice, generated code should be more precise than what a human could create. In reality, a human that really knows the language can do better. But, in my experience, that is a very small subset of humans, so keep it up.
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
If it works and meets performance and -ility expectations I wouldn't worry about it. It's always nice to find novel approaches that make the code smaller, cleaner, and/or faster but you could spend months on a solution that might not even exist and might mean absolutely nothing to anyone but yourself. That's time you could have poured into another project
Disclaimer: This advice is a little hypocritical as I have to actively stop myself from doing the same thing.
Unfortunately I have no idea what is acceptable because this is a tool for other people to use, not for a specific project or client.
It has competition though so anything smaller and/or faster is going to be "better", ie more desirable.
So there's that.
I have my own concerns about using this parser i generated because my CodeDomGoKit.brick.cs file is already over 500K and that's with a parser that's hand written and under 100K. Not 934K or whatever it was!
It's not a show stopper, but it's almost embarrassing for me to have build tools that are 1MB executables.
If competing with products in the market is the goal I can see the problem. Usually I try to stick to my original requirements/goals to avoid the endless cycle of "I could probably make this better" but that doesn't seem to be an option here with active competition.
Considering that, my only input would be that generated code will never be as efficient as hand-rolled. I'm running into a similar issue with a project that generates a full type-tree constructor for a given type given the data to "fill" that type tree. There are always going to be edge cases that exist in the general problem space which prevent some optimizations. You can't solve a general problem as efficiently as a specific problem.
Best of luck though! I only understand a fraction of what you post but it sounds like a really cool project
Something like that, yea. I'm creating a delegate for a type that constructs it and all of it's dependencies. I'm trying to write the data input/"parser" layer very generically so it can support a lot of cases, but the original idea related to parsing would be something like:
In this example you want to create the object based on (state, streetAddress)+ (i.e. one or more times), firstName, and lastName from the data.
You can add metadata to the items of interest, supply "parsers" for various members (based on whatever condition you want - type, member, or ID), and it uses the data to then create (possibly many) Users based on that data. Removes the need for boilerplate related to loading a domain object with parsing results or whatever your data source is (another object, database, etc). So instead of writing something like:
MatchCollection results = regex.Matches(/* some input*/);
User u = new User(results["firstName"], results["LN"]);
//this also only deals with a single address
Address a = new Address(results["street"], results["state"]);
ObjectGenerator g = new ObjectGenerator<User>().AddParser(regex);
ObjectGenerator g = new ObjectGenerator(typeof(User)).AddParser(regex);
User user = g.GenerateObject(/* some input*/);
User users = g.GenerateObjects(/* some input*/);
Not a finalized interface but that's the jist of it.
Very cool. I've been wanting to do something like that for a long time myself - a way to "bind" grammar constructs from say, an XBNF document to fields/properties in object models via metadata but i haven't found an expressive enough way to do it that isn't more work than just manually coding it. The upshot of doing that would be to get your parsed stuff directly into your final objects.
The upshot of doing that would be to get your parsed stuff directly into your final objects.
That's the goal! You nailed the main issue - that for simple single-use cases it's more work to do this than to just write the code manually. I'm attempting to make it expressive (and fast) enough to justify using with complex objects and/or multiple data source formats (XML, JSON, CSV, etc into the same object tree).
Since you seem to be the resident parsing expert, do you have any "must read" suggestions? I admittedly only know the basics but I've been interested in parsing for quite awhile since regular expressions in Perl were my introduction to programming. I got "Programming Perl" (a book I still own) as a gift over 18 years ago and after learning the basics of Perl, regular expressions were what cultivated my interest in programming.
I did a major hardware upgrade yesterday (motherboard, cpu , ram, gpu ... )
I tried re-activating but alas, it does not work (or I would not be asking).
On my device page it shows 2 devices, my old one and my current one (by motherboard model); I tought I could find the info on the old device and deactivate it (delete device) and apply it on the new device
Is there a way to get back my activation code/key from there ? I can't seem to find it.
I remember that I upgraded from Windows 8-ish when it was a free update; maybe I should hunt down my old CD/DVD of windows 8 ? Is that the way to go ?
When my son and I built his new PC last month we bought an upgrade license -- the old system was running Win 10 Home, we installed Win 10 Pro.
We replaced nearly everything -- kept only the CPU and an HDD -- and the install didn't want to accept the licence, so I eventually had to talk with a real live person at Microsoft who was able to do something with the kid's Microsoft account then zing bang it be worked.
So, I say, "try calling Microsoft".
Last Visit: 13-Aug-20 20:10 Last Update: 13-Aug-20 20:10