Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. I heard you like code in your code

I heard you like code in your code

Scheduled Pinned Locked Moved The Weird and The Wonderful
designcsharpcomgraphicsiot
15 Posts 11 Posters 18 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Daniel Pfeffer

    But can it generate itself?

    Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

    H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #4

    It had been awhile since I pulled up the code, but sure enough when I did, I found a Deslanged.Export.cs file in the Deslang project. Such files are created by Deslang itself. So I did use it to build itself. :-D

    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

    1 Reply Last reply
    0
    • H honey the codewitch

      I wrote a code generator that generates code that generates code. It's a tool for making code generators. It's generators all the way down. :laugh: GitHub - codewitch-honey-crisis/Deslang: Creates CodeDOM builder code from Slang (C# subset)[^]

      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

      R Offline
      R Offline
      RainHat
      wrote on last edited by
      #5

      I thought The Who did My Generation

      1 Reply Last reply
      0
      • H honey the codewitch

        I wrote a code generator that generates code that generates code. It's a tool for making code generators. It's generators all the way down. :laugh: GitHub - codewitch-honey-crisis/Deslang: Creates CodeDOM builder code from Slang (C# subset)[^]

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        D Offline
        D Offline
        den2k88
        wrote on last edited by
        #6

        I did it too, there is a big company that operates like that for their products.

        GCS/GE d--(d) s-/+ a C+++ U+++ P-- L+@ E-- W+++ N+ o+ K- w+++ O? M-- V? PS+ PE Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++*      Weapons extension: ma- k++ F+2 X The shortest horror story: On Error Resume Next

        1 Reply Last reply
        0
        • H honey the codewitch

          I wrote a code generator that generates code that generates code. It's a tool for making code generators. It's generators all the way down. :laugh: GitHub - codewitch-honey-crisis/Deslang: Creates CodeDOM builder code from Slang (C# subset)[^]

          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

          G Offline
          G Offline
          Gary Wheeler
          wrote on last edited by
          #7

          But can it generate DOOM? :-D

          Software Zen: delete this;

          1 Reply Last reply
          0
          • D Daniel Pfeffer

            But can it generate itself?

            Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

            J Offline
            J Offline
            jochance
            wrote on last edited by
            #8

            Cool stuff honey. The idea of code writing code is one of the first mind blowers that made me want to write code. Because you guys will like this if you haven't seen it, even though it's likely I found it from here somehow. This is in the same "codeception" vein. This image displays the CRC value of the file which contains it. [^]

            1 Reply Last reply
            0
            • T trønderen

              Sort of like YACCC.

              E Offline
              E Offline
              englebart
              wrote on last edited by
              #9

              The extra Cs evoke the yack/vomit homophone for me. Never happened with yak/yac/antlr/JavaCC/etc

              T 1 Reply Last reply
              0
              • E englebart

                The extra Cs evoke the yack/vomit homophone for me. Never happened with yak/yac/antlr/JavaCC/etc

                T Offline
                T Offline
                trønderen
                wrote on last edited by
                #10

                How about YACC[^]?

                1 Reply Last reply
                0
                • H honey the codewitch

                  I wrote a code generator that generates code that generates code. It's a tool for making code generators. It's generators all the way down. :laugh: GitHub - codewitch-honey-crisis/Deslang: Creates CodeDOM builder code from Slang (C# subset)[^]

                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                  1 Offline
                  1 Offline
                  10Besties UNBAISED REVIEWS
                  wrote on last edited by
                  #11

                  I think we can make Templates and use them in our code again and again. In this way, we can make programming easy.

                  1 Reply Last reply
                  0
                  • H honey the codewitch

                    I wrote a code generator that generates code that generates code. It's a tool for making code generators. It's generators all the way down. :laugh: GitHub - codewitch-honey-crisis/Deslang: Creates CodeDOM builder code from Slang (C# subset)[^]

                    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                    C Offline
                    C Offline
                    charlieg
                    wrote on last edited by
                    #12

                    Okay honey and all - I might come across harsh here, but why in the heck would you want to do this? I guess maybe if you wanted your own compiler? I can sort of see that. Context: I live in the land of really old code. Supporting legacy systems is my bread and butter. It's put multiple children through college, paid off the cars, and fed me. Cute and fancy scare me - it's okay, I'm an old ****. How would one support this? What problem is trying to be solved? Why would it make my life eaiser? For the record, I'm not a computer scientist, I'm an EE in embedded systems. So, I've never had a class in compiler theory or the more traditional CS studies. Keep your explanation simple :)

                    Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                    H 2 Replies Last reply
                    0
                    • C charlieg

                      Okay honey and all - I might come across harsh here, but why in the heck would you want to do this? I guess maybe if you wanted your own compiler? I can sort of see that. Context: I live in the land of really old code. Supporting legacy systems is my bread and butter. It's put multiple children through college, paid off the cars, and fed me. Cute and fancy scare me - it's okay, I'm an old ****. How would one support this? What problem is trying to be solved? Why would it make my life eaiser? For the record, I'm not a computer scientist, I'm an EE in embedded systems. So, I've never had a class in compiler theory or the more traditional CS studies. Keep your explanation simple :)

                      Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                      H Offline
                      H Offline
                      honey the codewitch
                      wrote on last edited by
                      #13

                      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: 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

                      1 Reply Last reply
                      0
                      • C charlieg

                        Okay honey and all - I might come across harsh here, but why in the heck would you want to do this? I guess maybe if you wanted your own compiler? I can sort of see that. Context: I live in the land of really old code. Supporting legacy systems is my bread and butter. It's put multiple children through college, paid off the cars, and fed me. Cute and fancy scare me - it's okay, I'm an old ****. How would one support this? What problem is trying to be solved? Why would it make my life eaiser? For the record, I'm not a computer scientist, I'm an EE in embedded systems. So, I've never had a class in compiler theory or the more traditional CS studies. Keep your explanation simple :)

                        Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                        H Offline
                        H Offline
                        honey the codewitch
                        wrote on last edited by
                        #14

                        Perhaps a concrete example will make my previous reply clearer. Rolex: Unicode Enabled Lexer Generator in C#[^] This is a command line tool that takes many regular expression based rules and generates a DFA lexer in one of many .NET languages. You can add 3rd party languages. (I'm hands off that part, but like IronPython probably has one). VB.NET and C# are supported on any system. Instead of writing the complicated code to do lexing in CodeDOM AST directly by hand coding new statements.Add(new CodeVariableDeclarationStatement(new CodeTypeReferenceExpression(typeof(int)), "foo", new CodePrimitiveExpression(0))); I can simply do int foo = 0; and it will create those big verbose objects on my behalf. So I wrote my TableTokenizer using that. I use Deslang to cook it into a codedom tree as a build step. Rolex then transforms that tree during runtime to include the computed DFA table used to make the lexer work (it's a series of int arrays basically, but could be anything)

                        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                        1 Reply Last reply
                        0
                        • H honey the codewitch

                          I wrote a code generator that generates code that generates code. It's a tool for making code generators. It's generators all the way down. :laugh: GitHub - codewitch-honey-crisis/Deslang: Creates CodeDOM builder code from Slang (C# subset)[^]

                          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                          C Offline
                          C Offline
                          Chris Maunder
                          wrote on last edited by
                          #15

                          "Down, down, down. Would the fall never come to an end? 'I wonder how many miles I've fallen by this time?'"

                          cheers Chris Maunder

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups