Need to write a language

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Need to write a language

Billy N. Patton
I'm in the semiconductor industry.  My job is to create data and to run
regression tests on that data for the validation of physical layout rules.

Skip to bottom for questions, if you don't want to read my ramblings.


The current problem is tha the rules are not in a computer readable form.
Many paople have a hand in writing different sections of the rules, so you
can imagine that the wording is widely varied.  There is no standard to
wording or even the dialog used.

One of the things I have been ask to do is to try and get a handle on how
the rules may be written that that they are computer readable.
I've been working with perl hash's and excel spread sheets.
The main problem I was having was that I was trying to decreace the
relationship words and increase the number of variables.  This was quickly
resulting in a spread sheet that was growing (number of columns) very
rapidly.  I assume excel has a limit to the number of columns.

The idea that I have come up with is to create a language with limited
descriptive words.  Here is an example of a rule that might be written in a
human readable form but also parsable by puter.

MET1 spacing to MET1 is 45 if MET1 width is <= 245 and >= 100

By looking at this
MET1 is a layer
Spacing width <= >= are relationships
If is a constraint
#'s are #'s

I want to have them write correct by construction.

Is it possible, in vim/gvim to open a special version of vim so that the
user can begin to type, spac , and it would complete the word?
Would it also be possible to not allow a word to be type'd if that word was
not in a list.

Vim would have to open in edit mode and remain there for most users, until
save/exit.  Most of the users of this would be hard core pc users who think
the only editor is "word".  But there are a few unix users.

My questions.
1. Can vim be configured to automatically start in edit mode?
2. Can vim monitor each word that is being typed?
3. Can vim do word completion?
4. Can vim offer all possible spellings for partial word completion?
If the answer to most of qeustion above is yes
5. Can I do the programming?  I do perl, c, c++, csh and sh programming.

Reply | Threaded
Open this post in threaded view
|

Re: Need to write a language

Karl Guertin
On 10/25/06, Billy Patton <[hidden email]> wrote:
>  I assume excel has a limit to the number of columns.

I believe the max is 65000 but that may be increased by now.

> Is it possible, in vim/gvim to open a special version of vim so that the
> user can begin to type, spac , and it would complete the word?

Yes.

> Would it also be possible to not allow a word to be type'd if that word was
> not in a list.

Harder, but probably.

> My questions.
> 1. Can vim be configured to automatically start in edit mode?

Yes, but I forget what the setting is, you can just push it into
insert mode when you enter a buffer if nothing else.

> 2. Can vim monitor each word that is being typed?

You can remap the spacebar to trigger a function without difficulty or
you can monitor every keystroke if you want something fancier.

:help map.txt
:help map-arguments
:help autocmd
:help autocmd-events

> 3. Can vim do word completion?

Many types. :help completion

> 4. Can vim offer all possible spellings for partial word completion?

It does by default and you can view them as a menu if you're using Vim
7. If you want to provide a list of possible words to be completed, it
can be done by creating a ctags file.

:help completeopt

> If the answer to most of qeustion above is yes
> 5. Can I do the programming?  I do perl, c, c++, csh and sh programming.

Most vim scripting is done in vimscript, which I consider to be fairly
close to bash/sh. You can also do scripting in Python. I'm not sure
about the perl interface.
Reply | Threaded
Open this post in threaded view
|

Re: Need to write a language

Peter Hodge-2
In reply to this post by Billy N. Patton
--- Billy Patton <[hidden email]> wrote:

> I'm in the semiconductor industry.  My job is to create data and to run
> regression tests on that data for the validation of physical layout rules.
>
> Skip to bottom for questions, if you don't want to read my ramblings.
>
>
> The current problem is tha the rules are not in a computer readable form.
> Many paople have a hand in writing different sections of the rules, so you
> can imagine that the wording is widely varied.  There is no standard to
> wording or even the dialog used.
>
> One of the things I have been ask to do is to try and get a handle on how
> the rules may be written that that they are computer readable.
> I've been working with perl hash's and excel spread sheets.
> The main problem I was having was that I was trying to decreace the
> relationship words and increase the number of variables.  This was quickly
> resulting in a spread sheet that was growing (number of columns) very
> rapidly.  I assume excel has a limit to the number of columns.
>
> The idea that I have come up with is to create a language with limited
> descriptive words.  Here is an example of a rule that might be written in a
> human readable form but also parsable by puter.
>
> MET1 spacing to MET1 is 45 if MET1 width is <= 245 and >= 100
>
> By looking at this
> MET1 is a layer
> Spacing width <= >= are relationships
> If is a constraint
> #'s are #'s
>
> I want to have them write correct by construction.
>
> Is it possible, in vim/gvim to open a special version of vim so that the
> user can begin to type, spac , and it would complete the word?
> Would it also be possible to not allow a word to be type'd if that word was
> not in a list.
>
> Vim would have to open in edit mode and remain there for most users, until
> save/exit.  Most of the users of this would be hard core pc users who think
> the only editor is "word".  But there are a few unix users.
>
> My questions.
> 1. Can vim be configured to automatically start in edit mode?
> 2. Can vim monitor each word that is being typed?
> 3. Can vim do word completion?
> 4. Can vim offer all possible spellings for partial word completion?
> If the answer to most of qeustion above is yes
> 5. Can I do the programming?  I do perl, c, c++, csh and sh programming.


Hello,

As well as completing words, it would be very helpful if you wrote a syntax
file for your language. If your users see things in color, they can be sure
they have typed the commands correctly, but if the text is *not* colored, then
they will know they've got something wrong.

Something else you may want to consider - Map <F5> to call a perl script which
examines the line under the cursor and prints a message explaining what needs
to be typed next.

regards,
Peter



               
____________________________________________________
On Yahoo!7
Win VIP tickets to meet R'n'B stars superstars Ne-Yo and Rihanna
http://advision.webevents.yahoo.com/aunz/music/jay_z_promotion/index.htm 

Reply | Threaded
Open this post in threaded view
|

Re: Need to write a language

Benji Fisher
In reply to this post by Karl Guertin
On Wed, Oct 25, 2006 at 06:42:15PM -0400, Karl Guertin wrote:
> On 10/25/06, Billy Patton <[hidden email]> wrote:
>
> >My questions.
> >1. Can vim be configured to automatically start in edit mode?
>
> Yes, but I forget what the setting is, you can just push it into
> insert mode when you enter a buffer if nothing else.

Add

:set insertmode
:help 'insertmode'

> >3. Can vim do word completion?
>
> Many types. :help completion

     Especially read

:help 'complete'
:help 'dictionary'

You may also find something worth borrowing in my word-completion plugin:
http://vim.sourceforge.net/scripts/script.php?script_id=73

> >4. Can vim offer all possible spellings for partial word completion?
>
> It does by default and you can view them as a menu if you're using Vim
> 7. If you want to provide a list of possible words to be completed, it
> can be done by creating a ctags file.
>
> :help completeopt

     I am not sure why you suggest a tags file, unless you intend

:set complete=t

I was thinking of

:set complete=k/path/to/babylanguage.txt

> >If the answer to most of qeustion above is yes
> >5. Can I do the programming?  I do perl, c, c++, csh and sh programming.
>
> Most vim scripting is done in vimscript, which I consider to be fairly
> close to bash/sh. You can also do scripting in Python. I'm not sure
> about the perl interface.

     I suggest looking at some of the files in $VIMRUNTIME/plugin/ to
get an idea of what you can do with a vim script.  Then it helps to look
at the list of built-in functions,

:help functions

HTH --Benji Fisher
Reply | Threaded
Open this post in threaded view
|

RE: Need to write a language

Billy N. Patton
In reply to this post by Peter Hodge-2
Thanks, eveything soundes goo so far.
I'll just have to determine if I can create the language for more of the
difficult rules

> -----Original Message-----
> From: Peter Hodge [mailto:[hidden email]]
> Sent: Wednesday, October 25, 2006 6:04 PM
> To: Billy Patton; [hidden email]
> Subject: Re: Need to write a language
>
> --- Billy Patton <[hidden email]> wrote:
>
> > I'm in the semiconductor industry.  My job is to create data and to
> > run regression tests on that data for the validation of
> physical layout rules.
> >
> > Skip to bottom for questions, if you don't want to read my
> ramblings.
> >
> >
> > The current problem is tha the rules are not in a computer
> readable form.
> > Many paople have a hand in writing different sections of
> the rules, so
> > you can imagine that the wording is widely varied.  There is no
> > standard to wording or even the dialog used.
> >
> > One of the things I have been ask to do is to try and get a
> handle on
> > how the rules may be written that that they are computer readable.
> > I've been working with perl hash's and excel spread sheets.
> > The main problem I was having was that I was trying to decreace the
> > relationship words and increase the number of variables.  This was
> > quickly resulting in a spread sheet that was growing (number of
> > columns) very rapidly.  I assume excel has a limit to the
> number of columns.
> >
> > The idea that I have come up with is to create a language
> with limited
> > descriptive words.  Here is an example of a rule that might
> be written
> > in a human readable form but also parsable by puter.
> >
> > MET1 spacing to MET1 is 45 if MET1 width is <= 245 and >= 100
> >
> > By looking at this
> > MET1 is a layer
> > Spacing width <= >= are relationships
> > If is a constraint
> > #'s are #'s
> >
> > I want to have them write correct by construction.
> >
> > Is it possible, in vim/gvim to open a special version of
> vim so that
> > the user can begin to type, spac , and it would complete the word?
> > Would it also be possible to not allow a word to be type'd if that
> > word was not in a list.
> >
> > Vim would have to open in edit mode and remain there for
> most users,
> > until save/exit.  Most of the users of this would be hard core pc
> > users who think the only editor is "word".  But there are a
> few unix users.
> >
> > My questions.
> > 1. Can vim be configured to automatically start in edit mode?
> > 2. Can vim monitor each word that is being typed?
> > 3. Can vim do word completion?
> > 4. Can vim offer all possible spellings for partial word completion?
> > If the answer to most of qeustion above is yes 5. Can I do the
> > programming?  I do perl, c, c++, csh and sh programming.
>
>
> Hello,
>
> As well as completing words, it would be very helpful if you
> wrote a syntax file for your language. If your users see
> things in color, they can be sure they have typed the
> commands correctly, but if the text is *not* colored, then
> they will know they've got something wrong.
>
> Something else you may want to consider - Map <F5> to call a
> perl script which examines the line under the cursor and
> prints a message explaining what needs to be typed next.
>
> regards,
> Peter
>
>
>
>
> ____________________________________________________
> On Yahoo!7
> Win VIP tickets to meet R'n'B stars superstars Ne-Yo and
> Rihanna
> http://advision.webevents.yahoo.com/aunz/music/jay_z_promotion
> /index.htm
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Need to write a language

A.J.Mechelynck
In reply to this post by Peter Hodge-2
Peter Hodge wrote:
[...]
> Hello,
>
> As well as completing words, it would be very helpful if you wrote a syntax
> file for your language. If your users see things in color, they can be sure
> they have typed the commands correctly, but if the text is *not* colored, then

...or if it is highlighted as Error (by default, white on red)...

> they will know they've got something wrong.
>
> Something else you may want to consider - Map <F5> to call a perl script which
> examines the line under the cursor and prints a message explaining what needs
> to be typed next.
>
> regards,
> Peter

Vim can interface with perl, python, ruby, tcl and/or mzscheme but only if the
corresponding interface is compiled-in and if the necessary libraries are
present (and can be found) at both compile-time and runtime. "Plain" vimscript
is usually enough to program anything that Vim can do.


Best regards,
Tony.