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.
The restaurant Blaze Pizza doesn't even offer straws. Instead they have lids that you sip from. Yup, that's right, adult sippie cups. And it is still difficult to get much out when there's a lot of ice.
Long ago in a country far away, we grew up only knowing straws made of waxed paper. Yes, they weren't perfect but at least we did not pollute the environment with plastic. I look forward to their return when we finally come to our senses and ban plastic straws forever!
If Google Translate's any help...I'm not talking about bottles (who drinks out of a bottle with a straw??) - I'm talking about these cardboard cups you get at fast-food restaurants, which are so flimsy you need the plastic lid to re-enforce them.
What I want to know is, how does that plastic straw get from my home to the ocean? I throw them in the recycling bin at home or in the trash if I'm out and about. I live 4 hours drive from the ocean and I know my trash goes to a land fill. Who digs through my trash, finds any straw that might be in there and then takes them on a long drive to toss them in the ocean?
How about wax paper straws near the ocean and those of us far from the sea can still have plastic?
And bring back the damn incandescent light bulb while you are at it.
So I finally got the regex optimizing compiler to spit the output i wanted
And it's almost perfect, save the jmp at the beginning the but that's negligible. This is nearly a pure DFA.
The tricky part is at the root some of my lexer expressions may not be able to be converted into this DFA (optimized) code. And while order of evaluation doesn't matter for DFAs it does matter for NFAs (any of the non-optimizable expressions)
So basically what I had to do was scan through my lex expressions top to bottom, looking for entire runs of optimizable expressions
Those I'd transform into a single DFA expression with multiple different match instructions.
And then I intersperse those with the unoptimized expressions in the same order they came to me in.
And boom it allows me therefore to go from
L0000: save 0
L0001: jmp L0002, L0008, L0019, L0022
L0002: set "A".."Z", "_", "a".."z"
L0003: jmp L0004, L0006
L0004: set "0".."9", "A".."Z", "_", "a".."z"
L0005: jmp L0003
L0006: save 1
L0007: match 0
L0008: jmp L0009, L0011
L0009: char "0"
L0010: jmp L0017
L0011: jmp L0012, L0013
L0012: char "-"
L0013: set "1".."9"
L0014: jmp L0015, L0017
L0015: set "0".."9"
L0016: jmp L0014
L0017: save 1
L0018: match 1
L0019: set "\t", "\n", "\v", "\f", "\r", " "
L0020: save 1
L0021: match 2
L0023: save 1
L0024: match -1
Which requires lots of fibers and therefore multiple scans of a character per pass
to this, which requires only two scans per pass max (error checking accounts for the extra jmp):
L0000: save 0
L0001: jmp L0002, L0008
L0002: switch case "\t".."\r", " ":L0003, case "-":L0003, case "0":L0005, case "1".."9":L0004, case "A".."Z", "_", "a".."z":L0005
L0003: switch case "1".."9":L0004
L0004: switch case "0".."9":L0004, default:L0006
L0005: switch case "0".."9", "A".."Z", "_", "a".."z":L0005, default:L0006
L0006: save 1
L0007: match 0
L0009: save 1
L0010: match -1
The only thing left i have to potentially do is eliminate that jmp at the beginning, and add the second operand as the default in the switch/case that follows.
Edit: Perf testing shows me maybe i don't need to that, as it's already on par with the DFA. WOO!
I'm proud of myself.
Edit: Whoops, bit of a bug i just noticed but minor.
Second, "rolex" might not be the best of names, as some company might object to it.
They can object all they like. Trademark law says I'm on solid footing. This isn't a watch or anything related to timepieces so it's not in the same industry, ergo, names can be the same without infringement, at least last time i talked to a copyright legal eagle about it.
Eddy Vluggen wrote:
Any chance you're going to dedicate an article to the subject?
No, it's not to do with the Win32 API. It's a fiber in concept though, and uses the same principles as CreateFiber does. It's a cooperatively scheduled Program fragment with its own instruction pointer (Index)