Jira (PUP-7093) Parser Combinators

2017-05-16 Thread Russell Mull (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Russell Mull updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-7093 
 
 
 
  Parser Combinators  
 
 
 
 
 
 
 
 
 

Change By:
 
 Russell Mull 
 
 
 

Labels:
 
 triaged 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7093) Parser Combinators

2017-02-02 Thread Lucas Yamanishi (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Lucas Yamanishi commented on  PUP-7093 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Parser Combinators  
 
 
 
 
 
 
 
 
 
 
Thomas Hallgren That makes sense. I think I would be happy with just Enum and Pattern-- not sure if either of those can take or return a start or finishing index. As far as returning an AST, that would be very useful. Perhaps something similar to the positional parameters of Regexp? 
Anyway, just an idea. Thanks for looking! 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7093) Parser Combinators

2017-01-13 Thread Thomas Hallgren (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Thomas Hallgren commented on  PUP-7093 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Parser Combinators  
 
 
 
 
 
 
 
 
 
 
Then again, how useful is it to have a full-blown parser that isn't capable of building an AST? A type will just validate, it won't produce anything. If we were to seriously consider this, then we should also consider how to use it for more than just validating a text. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7093) Parser Combinators

2017-01-13 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-7093 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Parser Combinators  
 
 
 
 
 
 
 
 
 
 
For this to work I think it needs an outer type that states the the type is a Grammar. The specification of the grammar's rules would then be based on types. That would require that there is a mapping from type to grammar rules and tokens. If the implementation of the lexing/parsing of that grammar is done naively in Ruby it would be horribly slow on anything beyond short input strings. I can imagine using racc to generate a parser, but that generation is not quick and something you would want to do as a build step. If we had access to C++ Boost parser generators it would be more feasible as it can build a grammar quickly at runtime. 
Wonder if Peter Huene can be nerd sniped... 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7093) Parser Combinators

2017-01-12 Thread Thomas Hallgren (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Thomas Hallgren commented on  PUP-7093 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Parser Combinators  
 
 
 
 
 
 
 
 
 
 
Although elegant, I don't think this proposal is feasible. A simple example like the Variant above where the Concat starts and ends with an Enum could perhaps work, but the more patterns, enums, and other types come into play and gets concatenated, the more inefficient the type checking would become. Some kind of scanner would need to be involved, attempting to resolve the first type, then the next, if next fails, go back to the first, retry with a different resolution (a pattern may match a partial string in more ways than one, especially if it's not anchored), try the next again, etc. until all types resolve (or not). The number of possible permutations that the resolver would need to go through would very quickly become very high. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-bugs@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/d/optout.


Jira (PUP-7093) Parser Combinators

2017-01-11 Thread Lucas Yamanishi (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Lucas Yamanishi updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-7093 
 
 
 
  Parser Combinators  
 
 
 
 
 
 
 
 
 

Change By:
 
 Lucas Yamanishi 
 
 
 
 
 
 
 
 
 
 I'd like to be able to match context-free languages using the type system. Most of the pieces are there, but it needs a {{Concat}} or {{Combinator}} type. Here's how I see it working.The {{Concat}} type would take multiple Scalars  ( and all of its sub-types  (converted to match strings ), other  Concats  {{Concat}} types ,  {{  Undef }}  and  {{  Optional }}  where  {{  Undef }}  matches the empty string, plus  Variants  {{Variant}} types  containing all these types (or maybe a new type of restricted  {{  Variant }} ). The type would concatenate its parameter types to create a recognizer for larger strings.  For example the following would match the strings {{'foo bar'}} and {{'foobar'}}.{code}Concat[  Enum['foo'],  Optional[Pattern[/\s/]  ],  Enum['bar']]{code}This could also be used to match complete contex-free languages. Take the  texbook  textbook  example of balanced parentheses.S → SSS → (S)S → εOr in BNF{code} ::= "" ::= | (  )|  {code}This could be expressed using Puppet type aliases as follows.{code}type BP = Variant[Enum[''], Concat[Enum['('], BP, Enum[')']], Concat[BP, BP]]{code}This alone could match some really complex things, like a user-defined subset of JSON, however it would be very difficult and ugly without PUP-7033. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
You received this message because you are subscribed to the Google Groups "Puppet Bugs" group.
To unsubscribe from this group a

Jira (PUP-7093) Parser Combinators

2017-01-11 Thread Lucas Yamanishi (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Lucas Yamanishi created an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-7093 
 
 
 
  Parser Combinators  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  New Feature 
 
 
 

Assignee:
 

 Unassigned 
 
 
 

Components:
 

 Language 
 
 
 

Created:
 

 2017/01/11 2:53 PM 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Lucas Yamanishi 
 
 
 
 
 
 
 
 
 
 
I'd like to be able to match context-free languages using the type system. Most of the pieces are there, but it needs a Concat or Combinator type. Here's how I see it working. 
The Concat type would take multiple Scalars (and all of its sub-types), other Concats, Undef and Optional where Undef matches the empty string, plus Variants containing all these types (or maybe a new type of restricted Variant). The type would concatenate its parameter types to create a recognizer for larger strings. For example the following would match the strings 'foo bar' and 'foobar'. 
 
 
 
 
 
 
Concat[ 
 
 
 
 
  Enum['foo'],