A brainfuck parser works now with newCTFE
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jul 29 19:16:22 PDT 2017
On Sunday, 30 July 2017 at 01:20:52 UTC, H. S. Teoh wrote:
> On Sun, Jul 30, 2017 at 01:15:50AM +0000, Stefan Koch via
> Digitalmars-d wrote:
>> Hi Guys,
>>
>> I just ran the first moderately complex ctfe function
>> successfully through newCTFE!
>>
>> This is the code that works now :
>>
>> module bf_parser;
> [...]
>> pragma(msg, parseBf("[,....]")[3].token);
>>
>> It has been a year of work to get to this point.
>> And it might seem a little trivial.
>>
>> But this is actually the a showcase of methods, slices,
>> strings and structs interacting.
>
> Very nice indeed!
>
> Out of curiosity, how does the performance of newCTFE compare
> to the current CTFE with the above code? E.g., if you pass in
> a BF program of non-trivial length, what's the difference in
> performance?
>
>
> T
newCTFE currently is about 3.65x faster.
(for a medium sized bf-program of 6467 bytes
which is parsed into 3441 RepeatedTokens);
More information about the Digitalmars-d
mailing list