Hi,
I'm currently making some custom AST parser for D :
http://pastebin.com/1hmnTUbY -- AST Parser
http://pastebin.com/ZRc5be1p -- Sum example
Right now both lexer and syntax parser are just awfull and they don't work
in CTFE because of class usage. But example looks rather interesting, with
"BLS" ?/?? ?
???:ics611$22s...@digitalmars.com...
> So in order to create a Tool which is able to create an SQL2D Translator
> (as D2 DLL/so) just by descrining Source an Target EBNF could be a great
> help.. Calling such an ready to use Translator whenever the standard D
"Don" wrote:
> Agreed. I've just looked through some code that I thought used them
> extensively, but found only two complex literals: 1i (dozens of instances)
> and 2i (one instance).
So if D removes complex literals what the proposed name for Imaginary One
would be?
_i , i_ , _i_, _
Oh sorry those @i and @j also would be build in. Ignore this.
"Lars T. Kyllingstad" wrote:
> And if someone *really* wants to put the "i" in there, they can just
> define it in their own app:
>
> enum i = Complex!double(0, 1);
> auto z = 0.998 + 2.72e-2*i;
>
> -Lars
>
Looks very nice.
"Andrej Mitrovic" wrote:
> The cool thing about D is that with a little bit of string magic you
> can make your own DSL's. Here's a rather hardcoded and superficial
> example, but for this simple case it works:
>
> http://pastebin.com/Xkghv1ky
>
> Of course you'd need to build your own little DSL
"Don" wrote:
> I don't think it's quite the same. In a makefile, every executable is
> listed, and so you can have some degree of control over it. But in this
> scenario, the compiler is making calls to arbitrary shared libraries with
> arbitrary parameters.
> It means the compiler cannot be t
"Stephan Soller" wrote:
> I don't think that the syntax improvement of chaining is worth such an
> effort. It adds tons of complexity for only a very limited gain. I'm not
> sure if I could write such self-parsed code without thinking about that
> pipeline.
I think I don't fully understand wh
"Stephan Soller" wrote
> I read your post in the context of method chaining with templates like
> filter! and map!. Looks like I missed the point. :)
>
> I think your idea is pretty impressive. Maybe useful for some high-level
> stuff like mathematical formulas.
Yes, I borrowed the idea and sy
"Don" wrote:
> In order for CTFE code to call pre-compiled code, three things are
> required:
> (1) the compiler needs to be able to find the file (.obj/.lib/shared
> library) containing the compiled code;
> (2) the compiler needs to be able to load the module and call it. This
> requires some
"Don" wrote:
> In order for CTFE code to call pre-compiled code, three things are
> required:
> (1) the compiler needs to be able to find the file (.obj/.lib/shared
> library) containing the compiled code;
> (2) the compiler needs to be able to load the module and call it. This
> requires some
"Andrej Mitrovic" wrote:
> I'm just having a look at this now, looks rather interesting! I'd love
> to be able to use some Python-like list comprehension tricks in my D
> code.
Yes list comprehension is also possible this way. But it is not very eye
handy right now even if fully implemented, beca
"Andrej Mitrovic" wrote:
> That's why I think it might be a better idea to simply use "DSL
> blocks" throughout your code. Instead of having to mixin each
> template, you would only have one template where you have all the
> rules for your DSL:
>
> float a = 1 ;
> int n = 10 ;
> // more D code..
"Don" wrote:
> It's not that complicated. Once you can load the library and call *one*
> function in it, the problem is solved.
> But at a deeper level, I'm not sure what you'd hope to achieve with this.
> I mean (excluding some not-yet implemented features), CTFE allows you to
> execute any pur
"Don" wrote:
>> Because the coder could have typed `0.0' instead of `0', the coder
>> probably wanted the compile time error you described.
>
> No. People expect sqrt(2) to compile, and to return 1.414
> For example, it works in C and in C++.
>
> The only other possible solution would be to d
"Andrej Mitrovic" wrote:
> There was some heated discussion about the disadvantages of using strings
> as a predicate, and coming up with some new syntax that DMD would support.
> Some people did not like using strings and would rather use _ or _0/_1
> instead of this:
>
> auto arr = [0,1,2,3,
"bearophile" wrote
>> - I like the idea of AST macros, they are powerful,
>
> A nice example of macro usage:
> http://lambda-the-ultimate.org/classic/message6437.html
>
> Bye,
> bearophile
>
D can also do some
https://github.com/AlexYD/DPP/blob/master/bin/Debug/test.d
"Regan Heath" wrote
> On Wed, 07 Nov 2012 15:51:50 -, Nick Sabalausky
> wrote:
>
>> On Tue, 06 Nov 2012 22:53:36 +0100
>> Artur Skawina wrote:
>>>
>>> "@[ArgumentList]".
>>>
>>
>> vote++
>>
>> It has all the benefits of '@(...)' (which are very compelling on
>> their own), but also has the
"Andrea Fontana" wrote:
>Is it possible to compile for avr (atmel) platform using gdc? It would be
>interesting for arduino development...
AVR is 8-bit harward architecture while D is designed for at least 32 bits.
Besides that AVR's have from (less then 1) to (a few) kB of RAM so it needs
an
>"Manu" wrote:
>I think you'll find that most arduino projects are using a much more
>capable avr chip, probably avr32 chips.
Never used Arduino but it's site and wikipedia mentiones only 8-bit AVR's
http://en.wikipedia.org/wiki/Arduino
Here http://arduino.cc/en/Main/Hardware also all AVR's are
>"Manu" wrote:
>I think you'll find that most arduino projects are using a much more
>capable avr chip, probably avr32 chips.
Never actually used arduino, but it's site and wikipedia mentiones 8-bit
devices http://en.wikipedia.org/wiki/Arduino .
Here also http://arduino.cc/en/Main/Hardware - all
"Daniel Murphy" wrote:
>There are 32 bit avrs. Search for 'AVR32'.
Thanks, I know :) But Arduino uses 8-bit.
>Andrea Fontana" wrote:
>In this case can we hope for a d frontend?
That depends if it's MCU or MPU. If it will be MCU(like ARM7TDMI), which means
Harvard Architecture (where Program code and RAM are physically different).
Also internal RAM of a few KB and no Linux.
If it'll be MCU then it can h
"Daniel Murphy" wrote:
> I'll take it you've never actually used c on a small embedded system?
>
> Of course you're doing all those things, if they're needed. Very low
> level programming in c does not need a runtime at all.
Probably you can stub all C runtime initializations. But why? Common C
"Nicolae Mihalache" wrote:
> Hello,
>
> I'm a complete newbie in D and trying to compare with Java. I
> implemented a simple test for measuring the throughput in message
> passing between threads. I see that Java can pass about 4mil
> messages/sec while D only achieves 1mil/sec. I thought that D
Sorry, my mistake. It's strange to have different 'n', but you measure speed
as 1000*n/time, so it's doesn't matter if n is 10 times bigger.
"Martin Nowak" wrote:
> Just wanted to point you to my working D lexer (needs a CTFE bugfix
> http://d.puremagic.com/issues/show_bug.cgi?id=6815).
>
> https://gist.github.com/1262321 D part
> https://gist.github.com/1255439 Generic part
Hi, how it should be compiled? I tried with DMD 2.057:
>dmd
"Andrei Alexandrescu" ???/ ?
?: news:iqq4jv$2eh3$2...@digitalmars.com...
>> So you have to write
>> std.parallel_algorithm.map() instead of map() all the time?
>
> alias std.parallel_algorithm p;
Not so easy:
1. This alias would break UFCS possibility.
2. p is very
"Steven Schveighoffer" ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ: news:op.vvou3fbgeav7ka@localhost.localdomain...
> Having seen quite a few incorrect descriptions of how D slices work
> (particularly regarding appending), I wrote an article that tries to
> describe how D slices work, and why they
There have been several topics discussing UFCS recently. So here is one
more)
One idea about UFCS - mark UFCS argument with @, @_, or _ symbol,
e.g. you have some function:
void func(Type1 p1, Type2 p2);
and later call it:
fucn(a, b); //or
a.func(@_, b); //or
b.func(a, @_);
This way Timon Gehr
"Andrej Mitrovic" ???/ ?
?: news:mailman.717.1307563594.14074.digitalmar...@puremagic.com...
> @_ <- that's a snail.
>
thanks, i didn't knew that :)
"Dmitry Olshansky" wrote
> what was so bad about having 'this' inside parameters?
> I thought it was rather compelling:
>
> void func(Type1 this, Type2 p2);
> which is legal only as a free function and inside structs/classes it's
> declaration syntax error.
>
> [3,2,5,3].cycle.stride(2).take(10);
"Dmitry Olshansky" ???/ ?
?: news:isopbg$1l5d$1...@digitalmars.com...
>> How does that prevent hijacking? If you want it to overload against
>> members of the
>> same name, you would have to introduce another overload set, not just
>> another
>> overload. (But inde
"Dmitry Olshansky" wrote:
>> Sure here you can, but in more complex cases or when you don't want to
>> strain you mind and memory.
>> a.someUnknownToReaderFunc(b).otherNotOftenUsedFunc(c)
>>
> Generally they are known to reader - they are free functions (and even
> small subset of those) anyway,
"Alex_Dovhal" wrote:...
[snip]
> member3(x, 1); //hundred times in user code
>
> And later library writer adds void member3(int a) member to class A.
> Now user code has name collision.
Sorry I meant x.member3(1);
"Jonathan M Davis" wote:
> Regardless, I see little point in using it for UFCS. If we want to
> specifically mark parameters for it, I think that the suggestion of using
> "this" makes a lot more sense. You wouldn't even have to change the
> grammar
> (unlike if you used @). You'd just change the
"Timon Gehr" wrote:
> String mixins themselves are 'a little bit ugly' (but unquestionably very
> useful).
> I think the syntax should keep reflecting that.
>
> Your proposal is a try to make up for Ds lack of macros. I'd prefer
> macros.
> Also overloading the meaning of 'mixin template' seems
"kenji hara" wrote:
> My proposal is just a syntactic sugar.
> You can develop such library without it.
yes, but still stable DMD release can't handle pointers in CTFE.
And without such syntactic sugar it's ungly to write something like that
mixin(sum!q{i : iota(N); mixin(sum!q{j : iota(M), j
"Timon Gehr" wrote:
> Macros operate on ASTs, not strings. You won't get real macros, just
> something
> that feels somewhat like them. You still could implement the equivalent to
> C
> macros (not real macros either) in a library, but they would have all the
> problems
> of C macros, as string
"kenji hara" wrote:
>Note: A simple way to construct environment for build dmd/druntime/phobos
>is:
>1. Expand newest release package.
>2. Replace dmd2/src/dmd, dmd2/src/druntime, and dmd2/src/phobos to
>checkouted git repositories.
>3. Copy https://gist.github.com/1045205 into dmd2/src
>I am
"%u" wrote:
> == Quote from kenji hara (k.hara...@gmail.com)'s article
>> Note: A simple way to construct environment for build dmd/druntime/phobos
>> i
>> s:
>> 1. Expand newest release package.
>> 2. Replace dmd2/src/dmd, dmd2/src/druntime, and dmd2/src/phobos to
>> checkouted git repositories.
"Timon Gehr" wrote:
> My question could not possibly be answered with 'yes', actually I was
> interested
> in what functionality your library would provide for the end user.
> You answered the question "Would your library be capable of building an
> AST?".
Sorry for ambiguity, "yes" was answer
"bearophile" wrote:
[...]
+1.0 vote.
Also, no one writes .5 or 3. on paper to save one char.
"Robert Jacques" wrote
> What I worry about though is variable hijacking rules. e.g.
>
> auto b = 5;
> reduce!\a+b(map!\a+b([1,2,3,4));
Nice.
What if we extend your proposal to
\(comma_separated_params)simple_expression
\(comma_separated_params){expressions}
Then no variable hijacking would be
"Alex_Dovhal" wrote
> reduce!\(a)a+b(map!\(x)x+b([1,2,3,4));
Sorry, my mistake
reduce!\(a,b)a+b(map!\(x)x+b([1,2,3,4));
"Robert Jacques" wrote
> Well, actually, this is Jason's proposal and it's explicitly for a
> std.algorithm style, by convention, super-short lambda syntax. i.e.
> primarily for one liners and std.algorithm. If you go the
> comma_separated_params, then I think the a => a+x; route is better.
Ma
On Wednesday, 4 June 2014 at 19:04:19 UTC, H. S. Teoh via
Digitalmars-d wrote:
It's strange, I find that even ambient music distracts me, yet
the loud
noise of an occasional passing train doesn't. Similarly, even
whispers
will distract me, but birds chirping, trees rustling, etc.,
don't. It's
On Saturday, 28 June 2014 at 10:42:19 UTC, Walter Bright wrote:
It happens with both numerical integration and inverting
matrices. Inverting matrices is commonplace for solving N
equations with N unknowns.
Errors accumulate very rapidly and easily overwhelm the
significance of the answer.
i
48 matches
Mail list logo