← Back to team overview

boots-developers team mailing list archive

Re: Regarding the blueprint on Perform proper parsing on lingo input.

 

Hi Ashish!

I'm CC'ing the boots developers list (https://launchpad.net/~boots-developers)
so other folks can comment as well. You probably want to join the group as well.

On Sat, Apr 03, 2010 at 06:08:21PM -0000, buck wrote:
>          I have been thinking on this blueprint to start my boots
> development journey. This is what I think about the idea.
> 
> 1. We first need to create lexers and parsers(maybe) for different
> lingos(first of all sql) so that we can identify what token has been
> entered (or should be entered) in input.
> 2. Specification for lexer of each lingo needs to be done separately.

I think this makes sense. Since more than one lingo can use SQL,
having a way to share the SQL parser/lexer components would be
great. For example, both the 'sql' and 'piped_sql' lingo would want
tab completion, so we'll want the ability to reuse that code. Of
course with piped_sql, we'll want to do tab completion for other
non-SQL components, such as nodes available to put in the pipe or
arguments that can be filenames (ok, maybe those are down the road).

> I think we can use the lexer generators to do this work for us. We will
> be needed to specify the grammar for lingo there.
> Right now I am studying how to use PLY, a python implementation for lex
> and yacc.

I'm not up on Python lexers/parser generators. Can anyone else comment
on Ply?

> Also I have questions related to it.
> Q0. Am I right ?

So far it sounds good, I'd see what some of the other devs have to say.

> Q1. Do we then need to do a character by character scan to look for
> tokens as they come? I think that if this blueprint is to support
> syntax-highlighting in future then character by character scan will be
> needed.

Initially I would only worry about scanning for completion on TAB,
but you certainly could do scans for each character for things like
syntax highlighting.

> Q2. For sql should we follow mysql's list of commands ?

Yeah, more or less. You can also look at the Drizzle parser located
in: drizzle/drizzled/sql_yacc.yy in the Drizzle source.

Thanks!
-Eric



Follow ups