Re: Pegged, a Parsing Expression Grammar (PEG) generator in D

2012-03-14 Thread Jay Norwood

On Saturday, 10 March 2012 at 23:28:42 UTC, Philippe Sigaud wrote:

* Grammars can be dumped in a file to create a D module.




 In reading the D spec I've seen a few instance where there are 
infered items such as auto for variables and various parameters 
in templates.  I presume your D grammar will have to have some 
rules to be able to infer these as well.


It seems like it would not be a big step to output what are the 
infered proper statements as the .capture output.  Is that 
correct?  I think that would be helpful in some cases to be able 
to view the fully expanded expression.


Re: Pegged: Syntax Highlighting

2012-03-14 Thread Andrej Mitrovic
On 3/14/12, Andrej Mitrovic  wrote:
> On 3/14/12, Andrej Mitrovic  wrote:
>> how would one use a parser like Pegged for syntax
>> highlighting?
>
> Ok, typically one would use a lexer and not a parser. But using a
> parser might be more interesting for creating more complex syntax
> highlighting. :)
>

Actually I think I can use the new ddmd-clean port for just this
purpose. Sorry for the noise.


Re: Pegged: Syntax Highlighting

2012-03-14 Thread Andrej Mitrovic
On 3/14/12, Andrej Mitrovic  wrote:
> how would one use a parser like Pegged for syntax
> highlighting?

Ok, typically one would use a lexer and not a parser. But using a
parser might be more interesting for creating more complex syntax
highlighting. :)


Re: std.log review suspended

2012-03-14 Thread Johannes Pfau
Am Tue, 13 Mar 2012 19:18:31 +0100
schrieb Johannes Pfau :

> Am Tue, 13 Mar 2012 00:07:01 +0100
> schrieb "David Nadlinger" :
> 
> > The extended review period for std.log has ended [1], and Jose, 
> > the author of the proposed module, has requested some extra time 
> > to incorporate the suggestions made during the review without 
> > ending up with a butchered design. Thus, the review process has 
> > been suspended as to not block the queue for too long.
> > 
> > This also means that review can start on the next proposal 
> > immediately. From the records, std.uuid would be next – are we 
> > good to go, Johannes? Other suggestions?
> 
> Give me a day or two. A recent change to dmd/phobos broke some of the
> unittests, I'll fix those first.

Ok, everything's working now (thanks to the folks in D.learn).

Here's a copy of the mail I sent to the phobos list some weeks ago:


About std.uuid (copied from the module documentation):
-
This is a port of boost.uuid from the boost project with some minor
additions and API changes for a more D-like API. A UUID, or Universally
unique identifier, is intended to uniquely identify information in a
distributed environment without significant central coordination. It
can be used to tag objects with very short lifetimes, or to reliably
identify very persistent objects across a network. UUIDs have many
applications. [...]
-

Code: https://github.com/jpf91/phobos/blob/std.uuid/std/uuid.d
API-Docs: http://dl.dropbox.com/u/24218791/d/src/uuid.html

Note: The code and documentation for sha1UUID has already been written,
but until phobos has support for SHA1, that can't be included. The code
is currently commented out in the source file (it's well tested
with some 3rd party SHA1 code), but the documentation for those
functions is included in the API-docs. I think those functions should
be reviewed as well, so that it's possible to add them to phobos with a
simple pull request at a later date.

Note2: std.uuid also needs this pull request:
https://github.com/D-Programming-Language/phobos/pull/398
It adds a isRandomNumberGenerator template to detect if a template
parameter is a random-number generator type. 



Re: Visual D 0.3.31 features GDC support

2012-03-14 Thread Piotr Szturmaj

Rainer Schuetze wrote:

Hi,

the new version of Visual D includes support for building and debugging
D projects with GDC, both Win32 and x64.


Cool! Keep up the good work!

I can't wait to test my projects with GDC-win...


Re: Visual D 0.3.31 features GDC support

2012-03-14 Thread Jakob Ovrum
On Wednesday, 14 March 2012 at 07:46:35 UTC, Rainer Schuetze 
wrote:

* property: fixed editing multiple configurations at once


Very happy to finally see this get fixed. In actual VisualD use, 
these issues are the most urgent. Thanks, and keep the project 
management improvements coming - I can't think of anything more 
important than getting the basics down!


Re: Pegged, From EBNF to PEG

2012-03-14 Thread Dmitry Olshansky

On 14.03.2012 2:49, Philippe Sigaud wrote:

On Tue, Mar 13, 2012 at 17:17, Dmitry Olshansky  wrote:


PEG defines order of alternatives, that is pretty much like a top-down
recursive descent parser would parse it. Alternatives are tried from left to
right, if first one fails, it tries next and so on.


Yes.


In an example I give B is always picked first and so C is never ever looked
at.


That's one of the caveats on PEG. That and greedy operators.

'a*a' never succeeds because 'a*' consumes all the available a's.



Hey, wait, I thought there has to be backtrack here, i.e. when second 
'a' finally fails?





Literal<- ("'" .+ "'") / ('"' .+ '"')


This needs escaping. Plain '.+' in pattern asks for trouble 99% of time.


This is an example were PEG would munch anything till the end, and
fail (since """ is not found in an empty string).
The standard PEG way to do that is

(!EndMarker .)+ EndMarker

It's a common enough pattern I tend to define a parameterized rule for that:

Until(Expr)<- (!Expr .)* Expr


Gotta love parametrized rules! 15' to code, a neverending stream of joy.


Nice!





In fact grammars are usually devised the other way around, e.g.
Start:
  Program ->  ...
Ehm... what the whole program is exactly ? Ok, let it be Declaration* for
now. What kind of declarations do we have? ... and so on. Latter grammars
get tweaked and extended numerous times.

At any rate production order has no effect on the grammar, it's still the
same. The only thing of importance is what non-terminal considered final (or
start if you are LL-centric).


Yes. The PEG standard seem to be that the first rule is the start
(root) rule. Pegged let you decide which rule you use for a start. The
rest is automatic.
I might change that.



--
Dmitry Olshansky


Re: Visual D 0.3.31 features GDC support

2012-03-14 Thread Dmitry Olshansky

On 14.03.2012 11:46, Rainer Schuetze wrote:

Hi,

the new version of Visual D includes support for building and debugging
D projects with GDC, both Win32 and x64.


Wow! Now that's a killer feature!



Here is a list of major changes:

2012-03-14 Version 0.3.31

* added support for building with GDC
* added platform support for "x64" (use with GDC only)
* includes new version 0.23 of cv2pdb that now also converts DWARF to pdb
* added option to "Intellisense" page to configure trigger of code
completion
* new version of mago with bug fixes and support for associative arrays
in expressions with basic key types
* property: fixed editing multiple configurations at once
* added Compile command to syntax check the current source file
* parser now supports new lambda syntax (x) => x
* fix resource include with spaces

Very short instructions on how to get started with GDC can be found
here: http://www.dsource.org/projects/visuald/wiki/Installation#UsingGDC

Visual D is a Visual Studio package providing both project management
and language services for the D programming language. It works with
Visual Studio 2005-11 as well as the free Visual Studio Shells.

The Visual D installer can be downloaded from its website at
http://www.dsource.org/projects/visuald

Rainer



--
Dmitry Olshansky


Visual D 0.3.31 features GDC support

2012-03-14 Thread Rainer Schuetze

Hi,

the new version of Visual D includes support for building and debugging 
D projects with GDC, both Win32 and x64.


Here is a list of major changes:

2012-03-14 Version 0.3.31

* added support for building with GDC
* added platform support for "x64" (use with GDC only)
* includes new version 0.23 of cv2pdb that now also converts DWARF to pdb
* added option to "Intellisense" page to configure trigger of code 
completion
* new version of mago with bug fixes and support for associative arrays 
in expressions with basic key types

* property: fixed editing multiple configurations at once
* added Compile command to syntax check the current source file
* parser now supports new lambda syntax (x) => x
* fix resource include with spaces

Very short instructions on how to get started with GDC can be found 
here: http://www.dsource.org/projects/visuald/wiki/Installation#UsingGDC


Visual D is a Visual Studio package providing both project management 
and language services for the D programming language. It works with 
Visual Studio 2005-11 as well as the free Visual Studio Shells.


The Visual D installer can be downloaded from its website at 
http://www.dsource.org/projects/visuald


Rainer


Re: Low feature GNUPlot controller for D2

2012-03-14 Thread Jay Norwood

On Wednesday, 14 March 2012 at 07:16:39 UTC, Jay Norwood wrote:
 >
I just tried this on Win7 64 bit using the latest TangoD2 and 
the gnuplot from this link

http://sourceforge.net/projects/gnuplot/files/

I had to substitute pgnuplot.exe, which is one of the windows 
gnuplot exe versions that accepts the piped input

GNUPlot = new Process(true, "pgnuplot.exe -persist");

With that change one of the graphs displayed, the one with 
title "Raw gnuplot commands".  The rest all failed, maybe due 
to the binary record input, which they try to echo to their 
text command shell.


Maybe if there were an option to use text format input, or 
maybe there is some terminator expected.  Their command shell 
fails to return to the prompt after echoing the binary data, 
and doesn't create the graph shell on these others that use the 
binary record input.


There was discussion of windows problems with the binary data 
input elsewhere, including some discussion of the input being 
opened in text mode.  Looks like the cygwin version might be a 
solution.


http://octave.1599824.n4.nabble.com/Gnuplot-scripts-as-output-td1680624.html

http://sourceforge.net/tracker/?func=detail&atid=102055&aid=2981027&group_id=2055


Re: Low feature GNUPlot controller for D2

2012-03-14 Thread Jay Norwood

On Sunday, 11 March 2012 at 21:45:02 UTC, SiegeLord wrote:
 > Anyway, the repository for it is here:

https://github.com/SiegeLord/DGnuplot
It requires TangoD2 to build and gnuplot 4.4.3 to run (unless 
you're saving commands to a file as described above).

It works on Linux, and maybe on Windows (untested).

-SiegeLord



I just tried this on Win7 64 bit using the latest TangoD2 and the 
gnuplot from this link

http://sourceforge.net/projects/gnuplot/files/

I had to substitute pgnuplot.exe, which is one of the windows 
gnuplot exe versions that accepts the piped input

GNUPlot = new Process(true, "pgnuplot.exe -persist");

With that change one of the graphs displayed, the one with title 
"Raw gnuplot commands".  The rest all failed, maybe due to the 
binary record input, which they try to echo to their text command 
shell.


Maybe if there were an option to use text format input, or maybe 
there is some terminator expected.  Their command shell fails to 
return to the prompt after echoing the binary data, and doesn't 
create the graph shell on these others that use the binary record 
input.