develooper Front page | perl.perl6.users | Postings from July 2007

Project Idea: Perl 6 Syntax Explainer

Thread Next
From:
Moritz Lenz
Date:
July 10, 2007 03:43
Subject:
Project Idea: Perl 6 Syntax Explainer
Message ID:
469362B9.2070901@casella.verplant.org
Hi,

considering the vast number of Operators and the like, I had the idea to
implement a tool where you can enter a small piece of p6 syntax, and it
explains what that might mean. (like a perldoc -f for operators/syntax
elements instead of functions)

A short example:
$ p6explain '[]'
[...] can be
     * '[$expression]': access to one or more array elements if used as
       postcircumfix
       Example: @a[2]; # access the third element of an array @a
     * '[$operator]': the 'reduce' hyper operator
       Example: [+] (1, 2, 3); # gives 1 + 2 + 3 == 6
In a regex/rule:
     * '[$subregex]': groups the content of the brackets without
       capturing the match result of $subregex

$ p6explain '*'
* can be
     * '$exp1 * $epx2' the multiplication operator, forces numerical
       context onto its arguments.
       Example: say 2 * 3;
     * 'multi sub *method_name' exports the sub method_name into the
       global namespace
In a regex/rule:
     * '$subregex*' is a quantifier meaning that the previous subregex
       may be repeated an arbitrary number of times, including zero
       times.
       Example: m/ [ab]* / matches '', 'ab', 'abab', 'ababab'

# END OF EXAMPLE


I have a few requirements in mind (not necessarily sorted by importance):
  * Free software: Artistic License 2, some BSDish or GPLish - I don't
    mind, as long as it's free ;)
  * Multiple frontends: I'd like to have at least a command line and a
    web frontend
  * Support for multiple (natural) languages.
  * Perhaps support for other programming languages as well
  * Should contain links/references to the official docs


Now I'd like to hear your opinion:
  * Anything else that should go into the requirements?
  * Is it useful at all?
  * Is it possible to implement it satisfactory without building a p6
    compiler?
  * Do you have a good idea for a project name?

Any other ideas and comments are welcome as well.

Cheers,
Moritz

-- 
Moritz Lenz
http://moritz.faui2k3.org/ |  http://perl-6.de/



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About