The corresponding definition for "type" from the puppet grammar is called "classname" and it is what is used to specify a resource "type". Written in (E)BNF the rules for the different types of names/ identifiers/references would be:

classname
  : NAME
  | CLASS_NAME
  | CLASS
  ;

NAME : (DEC | LOWER_ALPHA_CHAR) WORD_CHAR* ;
CLASS_NAME : (LOWER_ALPHA_CHAR WORD_CHAR*)? (NS LOWER_ALPHA_CHAR WORD_CHAR*)+;
CLASS_REF: (NS? UPPER_ALPHA_CHAR WORD_CHAR*)+ ;
DEC : '0'..'9' ;
LOWER_ALPHA_CHAR : 'a'..'z' ;
UPPER_ALPHA_CHAR : 'A'..'Z' ;
WORD_CHAR : (DEC | ALPHA_CHARACTER | UNDERSCORE) ;
ALPHA_CHARACTER : LOWER_ALPHA_CHAR | UPPER_ALPHA_CHAR ;
UNDERSCORE : '_' ;
NS : "::" ;
CLASS : "class" ;

This is what I am using in the Xtext based parser for .pp (and I double checked against the lexer/parser rules, but may have misunderstood something).


- henrik

On Dec 21, 2010, at 12:38 AM, Luke Kanies wrote:

Hi Kenn,

The BNF is definitely not complete - partially because I couldn't quite figure out how complete I could even make it. Or rather, I didn't take the time to do so. Can BNF include regexes?

In general, it should perfectly mirror the current state of Puppet's parser and lexer - that is, <type> should be defined as Puppet does, if at all possible[1]. I'd like to have it fleshed out with all of the regexes, and I'd much appreciate help in doing so.

1 - https://github.com/lak/puppet/blob/master/lib/puppet/parser/lexer.rb

On Dec 20, 2010, at 2:28 PM, Kenn Hussey wrote:

After looking at the BNF in more detail, I have a couple of questions:

1. Do you plan to provide definitions (regular expressions?) for the
<name>, <uc_name>, <naked_string>, and <quoted_string> elements?

2. Shouldn't the definition for <parameters> be recursive, e.g.,
<parameter> "," <parameters> instead of <parameter> "," <parameter>?
And if so, is <optional_comma> really needed?

3. Any further thoughts on what a suitable regular expression for
<type> might be?

Thanks,

Kenn


On Dec 20, 1:52 pm, Kenn Hussey <kenn.hus...@gmail.com> wrote:
Luke,

From the looks of things, this is quite relevant to the Puppet- related
work we're doing at Cloudsmith (see Henrik Lindberg's recent post to
the users group). We'd definitely like to help out, especially on the
Java front (most of our work is currently in Java). We've started
working with the BNF definition and will report back as soon as we
have something interesting to share.

Cheers,

Kenn

On Dec 2, 1:18 am, Luke Kanies <l...@puppetlabs.com> wrote:



Hi all,

Some have already noticed this, but I've begun a project to define and produce a minimal data-focused subset of Puppet's language, just like JSON is a data-focused subset of Javascript. I had initially called it MPF (for Minimal Puppet Format), but we've decided to use our internal name for it - p(0), or pzero:

https://github.com/lak/pzero

The only thing there so far is Jordan Sissel's work getting a Ragel parser to work, along with my attempt at a BNF definition. My hope is to have implementations in many languages:

* Ruby
* Python
* C
* Javascript
* Java

And I'd like each of these to be able to both parse and generate the format.

Jesse Wolfe first came up with this idea, and our goal is to have a language that any project or tool can use to describe desired system state. I'm especially interested in having tools for converting to and from existing data formats, like the rpm and dpkg manifest formats.

So anyway, if this is interesting to you, I'd love help on it. We're still in the formative stages of what it is and what it would do, but we're pretty excited by the potential. One of the things we clearly need to develop is a list of example files that each implementation could test against.

--
Tradition is what you resort to when you don't have the time or the
money to do it right.       -- Kurt Herbert Alder
---------------------------------------------------------------------
Luke Kanies  -|-  http://puppetlabs.com -|-   +1(615)594-8199

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-...@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en .



--
Opportunity is missed by most people because it is dressed in overalls
and looks like work.        -- Thomas A. Edison
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199




--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-...@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en .


--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To post to this group, send email to puppet-...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to