Click here to Skip to main content
15,887,135 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: I heard you like code in your code Pin
trønderen19-Nov-23 23:46
trønderen19-Nov-23 23:46 
GeneralRe: I heard you like code in your code Pin
englebart1-Dec-23 15:58
professionalenglebart1-Dec-23 15:58 
GeneralRe: I heard you like code in your code Pin
trønderen4-Dec-23 6:54
trønderen4-Dec-23 6:54 
JokeRe: I heard you like code in your code Pin
RainHat20-Nov-23 1:26
RainHat20-Nov-23 1:26 
GeneralRe: I heard you like code in your code Pin
den2k8820-Nov-23 2:43
professionalden2k8820-Nov-23 2:43 
GeneralRe: I heard you like code in your code Pin
Gary Wheeler30-Nov-23 1:33
Gary Wheeler30-Nov-23 1:33 
GeneralRe: I heard you like code in your code Pin
charlieg5-Jan-24 7:41
charlieg5-Jan-24 7:41 
GeneralRe: I heard you like code in your code Pin
honey the codewitch5-Jan-24 9:39
mvahoney the codewitch5-Jan-24 9:39 
Basically because I wanted templatizable source code that

A) I could visit and transform
B) I could render out to other .NET languages.

Now I'm going to get into the weeds a bit, if not for you then for other readers. Follow along as you can, but it's not critical that you understand this stuff - anyway:

A and B are what Microsoft .NET's CodeDOM allows you to do. It's an abstract syntax tree with objects representing things like CodeConditionStatement for "if" and CodeVariableDeclarationStatement for declaring a local variable.

You can take that tree and render it to C# or VB.NET out of the box. Or other languages if it has a 3rd party provider for it - any language that can work in ASP.NET has a sporting chance of working with this because they both use the CodeDOM to do their magic.


The trouble with the CodeDOM is it doesn't have a parser. You have to build those trees by hand, and they are extremely verbose.

So I wrote one. It parses a CodeDOM compliant subset of C#6 and builds that codedom tree from what you type in.

Viola! I have templatizable, transformable, language agnostic code that now I can write in (almost) C# (C# can express more than the CodeDOM can so I had to limit what I could support). That code is VB.NET code. That code is C#. That code is potentially F# code, etc.

The trouble with *that* is C# doesn't give you type information, and you need that information to fully manifest what you parsed. Otherwise what you get back is ambiguous.

I resolve those ambiguities when I cook that C# subset into a CodeDOM tree. It takes time.

Deslang (my code generator generator) takes that code, does all the cooking, and produces code that can reinstantiate that code tree instantly on demand. Everything was resolved up front, and the result turned into code that produces a code tree that can render code. Laugh | :laugh:

For future transformation or rendering to one of many .NET languages.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix

GeneralRe: I heard you like code in your code Pin
honey the codewitch5-Jan-24 9:48
mvahoney the codewitch5-Jan-24 9:48 
GeneralRe: I heard you like code in your code Pin
Chris Maunder11-Jan-24 1:27
cofounderChris Maunder11-Jan-24 1:27 
GeneralThe biggest little array you've ever seen. Pin
honey the codewitch18-Nov-23 6:26
mvahoney the codewitch18-Nov-23 6:26 
GeneralRe: The biggest little array you've ever seen. Pin
Andre Oosthuizen18-Nov-23 7:57
mveAndre Oosthuizen18-Nov-23 7:57 
GeneralRe: The biggest little array you've ever seen. Pin
trønderen18-Nov-23 9:25
trønderen18-Nov-23 9:25 
GeneralRe: The biggest little array you've ever seen. Pin
honey the codewitch18-Nov-23 9:26
mvahoney the codewitch18-Nov-23 9:26 
GeneralQuick Tip: Windows Explorer, best shortcut ever!!! PinPopular
raddevus23-Oct-23 8:54
mvaraddevus23-Oct-23 8:54 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
Mircea Neacsu23-Oct-23 10:38
Mircea Neacsu23-Oct-23 10:38 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
raddevus23-Oct-23 10:48
mvaraddevus23-Oct-23 10:48 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
Mircea Neacsu23-Oct-23 10:55
Mircea Neacsu23-Oct-23 10:55 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
raddevus23-Oct-23 10:55
mvaraddevus23-Oct-23 10:55 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
PIEBALDconsult23-Oct-23 12:45
mvePIEBALDconsult23-Oct-23 12:45 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
raddevus24-Oct-23 2:44
mvaraddevus24-Oct-23 2:44 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
PIEBALDconsult24-Oct-23 4:23
mvePIEBALDconsult24-Oct-23 4:23 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
Peter Kassenaar24-Oct-23 23:57
Peter Kassenaar24-Oct-23 23:57 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
PIEBALDconsult25-Oct-23 3:53
mvePIEBALDconsult25-Oct-23 3:53 
GeneralRe: Quick Tip: Windows Explorer, best shortcut ever!!! Pin
sasadler25-Oct-23 6:12
sasadler25-Oct-23 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.