[HN Gopher] Show HN: Compile C to Not Gates
       ___________________________________________________________________
        
       Show HN: Compile C to Not Gates
        
       Hi! I've been working on the flipjump project, a programming
       language with 1 opcode: flip (invert) a bit, then jump
       (unconditionally). So a bit-flip followed by more bit-flips. It's
       effectively a bunch of NOT gates. This language, as poor as it
       sounds, is RICH.  Today I completed my compiler from C to FlipJump.
       It takes C files, and compiles them into flipjump. I finished
       testing it all today, and it works! My key interest in this project
       is to stretch what we know of computing and to prove that anything
       can be done even with minimal power.  I appreciate you reading my
       announcement, and be happy to answer questions.  More links:  - The
       flipjump language: https://github.com/tomhea/flip-jump
       https://esolangs.org/wiki/FlipJump  - c2fj python package
       https://pypi.org/project/c2fj/
        
       Author : tomhee
       Score  : 54 points
       Date   : 2025-01-17 19:36 UTC (3 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | dang wrote:
       | Looks like we banned you and this domain because of the egregious
       | vote manipulation and bogus comments at
       | https://news.ycombinator.com/item?id=34856792.
       | 
       | That was a long time ago, though, and the project is interesting
       | enough, so I'm going to assume you've learned your lesson and
       | unban you. Please stop using multiple accounts for this though!
        
         | jimbob45 wrote:
         | Dang, I have to know what triggered you to say this. It's not
         | the same user account so you would have had to have recognized
         | the URL and written based on that.
         | 
         | Do you keep notes on each astroturfed submission and auto-
         | trigger reposts to notify yourself? Or did you just happen to
         | recognize this? 20 minutes from his post to your comment is
         | absurdly good moderation.
        
           | dang wrote:
           | https://news.ycombinator.com/item?id=42742462 was on the
           | front page. We got an email suggesting that the URL should be
           | https://github.com/tomhea/c2fj instead of
           | https://github.com/tomhea/flip-jump. That made sense, except
           | it turned out that github.com/tomhea was banned. That seemed
           | odd because we don't normally ban github domains, so I looked
           | at the history
           | https://news.ycombinator.com/from?site=github.com%2Ftomhea
           | (most of which will only be visible to users who have
           | 'showdead' set to 'yes' in their profile), and it was pretty
           | easy to see that
           | https://news.ycombinator.com/item?id=34856792 was, let's call
           | it, the original sin in this chain of woe. It was also pretty
           | obvious that the other submitting accounts were all related.
           | Since the project itself is interesting I figured the best
           | thing to do was give the submitter a second chance, so I
           | picked the earlier post from today (the OP) and swapped it
           | out for the other one (42742462).
           | 
           | I hope that answers your question!
        
             | doormatt wrote:
             | You sir, are amazing. Thank you for being so utterly
             | transparent.
        
         | tomhee wrote:
         | Thanks man, I appreciate it.
        
       | tomhee wrote:
       | There is also a brainfuck to flipjump compiler:
       | https://github.com/tomhea/bf2fj
        
         | david-gpu wrote:
         | Ah, the convenience of brainfuck with the performance of flip
         | jump. Excellent.
        
       | bangaladore wrote:
       | Reminds me of movfuscator [1]. This can compile programs to movs
       | and only movs.
       | 
       | [1] https://github.com/Battelle/movfuscator
        
         | LPisGood wrote:
         | Battelle is great. They also created some software called
         | Cantor Dust [1] that turns files into images to allow humans to
         | easily spot obfuscated data or files.
         | 
         | The sad thing about this kind of work, because I love it, is
         | that to get paid to do it you need clearances and polygraphs
         | and periodic reinvestigations/continuous monitoring and all
         | sorts of things that I find unpleasant.
         | 
         | [1] https://github.com/Battelle/cantordust
        
       | platz wrote:
       | How is a jump realized by Not Gates?
        
         | Jerrrry wrote:
         | I'm guessing by not jumping into a terminating/ halting NOOP.
         | 
         | The logic is within the branching.
        
         | tomhee wrote:
         | I dont think that the jump can be realized by NOT gates, but
         | it's essentially "where to find the next NOT command". The jump
         | is indeed a crucial part of the language, as it allows going
         | back, and especially to make self-modifying code.
        
       | tromp wrote:
       | Am I right in deducing that this language gets its power from
       | self-modifying code? I.e. flipping bits within addresses of the
       | opcodes of the running program?
        
         | tomhee wrote:
         | You are indeed right
        
           | tromp wrote:
           | I would have expected the language documentation to focus
           | more on this observation and to explain for instance how self
           | modification is used to implement while loops. But I don't
           | even see the term mentioned anywhere?!
        
             | tomhee wrote:
             | Good point! It's mentioned in the github wiki here:
             | https://github.com/tomhea/flip-jump/wiki/Learn-
             | FlipJump#memo...
             | 
             | It was once in the Readme but as I kept developing it more
             | it become longer and longer, so I moved it into the wiki,
             | and especially to here: https://esolangs.org/wiki/FlipJump
        
       | tomhee wrote:
       | By the way, as a challenge, try how you can program an "If"
       | statement in Flipjump.
        
       | dlcarrier wrote:
       | Maxim (now owned by Analog) actually manufactures a single-
       | instruction processor series, called MAXQ. It uses a single move
       | instruction, with a flag for literals, and a transport triggered
       | architecture.
        
       | artemonster wrote:
       | Id appreciate more explanations from the power of combined
       | bitflip & goto
        
         | tomhee wrote:
         | Sure!
         | 
         | https://github.com/tomhea/flip-jump/wiki/Learn-FlipJump
         | 
         | This will let you understand how to implement the very basic
         | "if" in flipjump.
         | 
         | I tried to make it as easy for newcomers, but please feel free
         | and update me if something is written complicated.
         | 
         | After you understand up to the macros, you can try yourself to
         | understand the xor macro, which most of the library is built
         | based on it: https://github.com/tomhea/flip-
         | jump/blob/fe51448932e78db7d76...
        
       | jumploops wrote:
       | AND, OR, NOT - pick 2
        
         | sroussey wrote:
         | NOR - pick 1
        
       | jkrshnmenon wrote:
       | I wonder if someone has already made a Reverse Engineering CTF
       | challenge for this concept.
        
         | tomhee wrote:
         | There actually was one with subleq:
         | https://www.google.com/amp/s/blog.attify.com/flare-4-ctf-wri...
        
       | pizza wrote:
       | Ah interesting.. wonder if you can model this with a recursively
       | expanded algebraic expression. I've been thinking lately along
       | similar lines about polynomials that encode pushdown automata, so
       | this is cool to see.
        
         | tomhee wrote:
         | If you have an answer I'd be happy to hear it!
        
       ___________________________________________________________________
       (page generated 2025-01-17 23:00 UTC)