On Saturday, 25 February 2012 at 22:55:37 UTC, Walter Bright
wrote:
Most straight up GC vs malloc/free benchmarks miss something
crucial. A GC allows one to do substantially *fewer*
allocations. It's a lot faster to not allocate than to allocate.
The trouble is you don't have to look far to fi
On Saturday, 18 February 2012 at 22:35:58 UTC, Jonathan M Davis
wrote:
I'd hate to see us have a crippled exception hierarchy just
because some
people mishandle exceptions and simply print out messages on
failure in all
cases. Obviously sometimes that's what you have to do, but
often you can
ha
On Sunday, 4 March 2012 at 21:00:00 UTC, Andrei Alexandrescu
wrote:
You can get away without an AST for the simplest grammars (e.g.
printf etc.) but in that case you compete with hand-written
code. I wouldn't think of parsing a serious grammar with more
than a few productions without generating
Hi Nick,
On Wednesday, 29 February 2012 at 17:16:44 UTC, Nick Sabalausky
wrote:
One thing I've been wanting to see in a lexer's regex would be
a way to
match things like D's nested comments or:
I have already implemented a lexer generator that can handle
recursion in the token definitions (us
It seems like the best way to go is to use dchar for strings (i.e. not have
the struct as a template) as I need real characters for intersection purposes.
When it comes to lookup, any input will need converting to dchars (I expect
this can be done on the fly).
In C++ you would use iterators to do
== Quote from bearophile (bearophileh...@lycos.com)'s article
> Ben Hanson:
> Even if you are an expert C++ programmer, I can express few more comments
> about
your code, to show how to program in D (here I comment only the first example of
each thing. More cases can follow).
It
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article
> On 06/22/2010 08:13 AM, Ben Hanson wrote:
> > Here's the latest with naming convention (hopefully) followed. I've
> > implemented my
> > own squeeze() function and used sizeof in t
== Quote from Rory McGuire (rmcgu...@neonova.co.za)'s article
> On Tue, 22 Jun 2010 15:31:14 +0200, Ben Hanson
> wrote:
> > == Quote from Rory McGuire (rmcgu...@neonova.co.za)'s article
> >> On Tue, 22 Jun 2010 15:13:06 +0200, Ben Hanson
> >> wro
== Quote from Rory McGuire (rmcgu...@neonova.co.za)'s article
> On Tue, 22 Jun 2010 15:13:06 +0200, Ben Hanson
> wrote:
> > Here's the latest with naming convention (hopefully) followed. I've
> > implemented my
> > own squeeze() function and used sizeof
Here's the latest with naming convention (hopefully) followed. I've implemented
my
own squeeze() function and used sizeof in the memmove calls.
How can I specify wide strings for the literals?
Thanks,
Ben
module main;
import std.algorithm;
import std.array;
import std.c.string;
import std.str
> == Quote from bearophile (bearophileh...@lycos.com)'s article
> > In D style guide structs and classes need to start with an upper case, in
> CamelCase. And variable names are written in camelCase with a starting lower
> case:
> > http://www.digitalmars.com/d/2.0/dstyle.html
> > Following a comm
== Quote from bearophile (bearophileh...@lycos.com)'s article
> Ben Hanson:
> > The underscores thing just comes from the C++ source.
> But once your program works well you can change the variable names a little,
> or
even before if you have some kind of IDE.
> In D
== Quote from div0 (d...@users.sourceforge.net)'s article
> On 19/06/2010 20:39, Ben Hanson wrote:
> > From memory (Joel did a PDF recently, but that is on my works machine)
> > Joel has
> > been developing Spirit for over ten years. The latest version is pretty
>
== Quote from Nick Sabalausky (a...@a.a)'s article
> "Ben Hanson" wrote in message
> news:hvj9i1$1q7...@digitalmars.com...
> > Lua has an interesting pattern matcher, as it goes more in
> > the formal grammar direction to (for example) match balanced parenthes
== Quote from Rory McGuire (rmcgu...@neonova.co.za)'s article
> I think sizeof is a property, e.g. char.sizeof or:
> struct A {
> int a;
> char[10] b;
> }
> A.sizeof
> A a;
> a.sizeof
> you get the picture. (Have I got it?)
> -Rory
Thanks Rory.
== Quote from bearophile (bearophileh...@lycos.com)'s article
> Ben Hanson:
> > It still needs some work as memmove works with bytes so I need the
> > equivalent of 'sizeof' in D for this.
> T.sizeof gives the size of the init of a variable of type T.
> If T is
Hi there,
I've basically got the string_token class working now. Thanks to everyone who
helped. It still needs some work as memmove works with bytes so I need the
equivalent of 'sizeof' in D for this.
'squeeze' doesn't work with wide chars, so I will write my own version.
When I shrink or grow c
I've changed the code to use CharT[] again, which simplified things
substantially. However, I can't find a way to erase characters from a char[].
Can anyone help?
See the current code below.
Thanks,
Ben
module main;
import std.algorithm;
import std.string;
template regex(CharT)
{
struct basic
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article
> On 06/19/2010 03:35 AM, Ben Hanson wrote:
> > I can't prove what the comlexity is for DFA compilation, but instead, I
> > challenge anyone to show slow compilation times with any DFA compatible
>
Hi Andrei,
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article
> On 06/20/2010 12:56 PM, Ali Çehreli wrote:
> > Ben Hanson wrote:
> >> == Quote from Justin Spahr-Summers (justin.spahrsumm...@gmail.com)'s
> >>> "string"
== Quote from Justin Spahr-Summers (justin.spahrsumm...@gmail.com)'s
> "string" is actually an alias for "immutable(char)[]" (and
similarly for
> the other string types), so its contents are not modifiable, though
its
> length can be adjusted and contents appended. If you need to be
able to
> modif
== Quote from Don (nos...@nospam.com)'s article
> Ben Hanson wrote:
> > == Quote from BCS (n...@anon.com)'s article
> >> Hello bearophile,
> >>> Ben Hanson:
> >>>
> >>>> Can you output source code at compilation time and have
I forgot to mention... Ideally I'd like some kind of abstract interface to the
generated DFA (this is in data mode before code generation etc.) so that
different implementations can be hidden under a common interface.
This is another example of why it would be nice to discuss the implementation
wi
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article
> On 06/19/2010 03:35 AM, Ben Hanson wrote:
> > I can't prove what the comlexity is for DFA compilation, but instead, I
> > challenge anyone to show slow compilation times with any DFA compatible
regex.
&
Hi Justin,
== Quote from Justin Spahr-Summers (justin.spahrsumm...@gmail.com)'s article
> "string" is actually an alias for "immutable(char)[]" (and similarly for
> the other string types), so its contents are not modifiable, though its
> length can be adjusted and contents appended. If you need t
> because strings aren't mutable. char[]'s on the other hand are, so you
> could just change temp_'s type to
> import std.traits;
> Unqual!(typeof(StringT.init[0]))[] temp_;
> or something like that.
Thanks Ellery.
Hi BCS,
== Quote from BCS (n...@anon.com)'s article
> Hello Ben,
> >This would lead to huge
> > interest from the boost.spirit guys...
> I don't remember what versions this is (I've done about 3 that I can remember)
> or even if it works, but I wonder if they would have any interest in this:
> http
Hi there,
I'm converting the following C++ function to D:
void negate ()
{
const std::size_t max_chars_ = sizeof (CharT) == 1 ?
num_chars : num_wchar_ts;
CharT curr_char_ = sizeof (CharT) == 1 ? -128 : 0;
string temp_;
const CharT *curr_ = _char
== Quote from BCS (n...@anon.com)'s article
> Hello bearophile,
> > Ben Hanson:
> >
> >> Can you output source code at compilation time and have D compile it,
> >> or do you use a load of recursion like C++ TMP?
> >>
> > This can be done with
Hi Andrei,
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s
article
> On 06/19/2010 08:47 AM, Ben Hanson wrote:
> > Hi there,
> >
> > Can anyone tell me how to get the maximum char value from a string
> > type? I have a template struct whic
Hi BCS,
== Quote from BCS (n...@anon.com)'s article
> Hello Ben,
> > Hi there,
> >
> > Can anyone tell me how to get the maximum char value from a string
> > type? I have a template struct which can take string or wstring
and
> > need to determine the character type from the string type.
> >
> If
Hi Justin,
== Quote from Justin Johansson (n...@spam.com)'s article
> Ben, are you talking about a lexical value space or a value value space?
> It might help you to solicit a better answer if you posted some code
> such as your template struct, and perhaps some method function signatures.
> It wo
Hi there,
Can anyone tell me how to get the maximum char value from a string
type? I have a template struct which can take string or wstring and
need to determine the character type from the string type.
Thanks,
Ben
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article
> The NFA->DFA algorithms are what I was referring to. My copy of the
> dragon book suggests that DFAs usually have O(n^3) initialization time
> but O(n^2 * 2^n) worst case relative to the number of states. I'd love
> to be shown
OK, I've just ordered The D Programming Language from Amazon. Hopefully this
will
enable me to cut out a certain amount of total n00b questions such as "How do
strings work?".
Regards,
Ben
Hi Ellery,
== Quote from Ellery Newcomer (ellery-newco...@utulsa.edu)'s article
> I've always understood that dfas have an exponential lower bound
> relative to .. something .. but I don't believe I have ever actually
> used a dfa generator (or written one, sadly enough). What has your
> experienc
Reading your original post again and thinking about this a bit more...
If someone can help me get up to speed with TMP in D, I could probably put
together a proof of concept pretty quickly. Aside from the D syntax, it is all
in the design (which is why I would like to discuss it in more detail). F
Hi Andrei,
I am unable to offer to write an entire compile time regex library in D, but it
is certainly an interesting subject for me and would be happy to contribute to
any discussions. I am sure a D implementation could be much more successful
than a C++ TMP DFA producer (see http://old.nabble.c
Andrei Alexandrescu Wrote:
> Walter Bright wrote:
> > Andrei Alexandrescu wrote:
> >> Oh, one more thing: doing mixed-width searches would require decoding.
> >
> > Or a conversion before the loop starts of the search term.
>
> That triggers memory allocation plus the same cost. It's not likely
By the way I forgot a link to 'Secure STL':
http://channel9.msdn.com/shows/Going+Deep/STL-Iterator-Debugging-and-Secure-SCL/
'nuff said.
Regards,
Ben
dsimcha Wrote:
> == Quote from "Jérôme_M._Berger" (jeber...@free.fr)'s article
> > PS: At work, we mustn't use C++ because:
> > - It's slow;
> > - Its standard library is too big (100k);
> > - In a future product, we might want to reuse this module and not
> > have C++ (Oh, yes I didn't tell you t
Hi there,
My name is Ben Hanson and I am the author of lexertl
(http://www.benhanson.net/lexertl.html), a lexical analyser generator written
in C++. As the generator is modular, code generators can be added easily as
separate files which means it is easy to output code for any language.
I am
42 matches
Mail list logo