SPICE syntax and grammer

Hi, does anyone know where I can get a formal Backus-Naur style syntax and/or grammar definition for any of the various SPICEs out there?

Specifically, hspice, pspice, or berkeley spice. What is the difference from a grammar/syntax perspective?

thanks ms

Reply to
63q2o4i02
Loading thread data ...

I have no idea what "a formal Backus-Naur style syntax" is.

Are you speaking of "commands" such as .TRAN, etc?

If that is what you are after, the various SPICE's have the same command line structure, except that HSpice has a few additional ones, .ALTER for instance, that I wish PSpice had :-(

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Hi,

The backus-naur grammar format specifies exactly how a spice parser would read in the text file and create the data structures representing the circuit.

For instance, a parameter list would be something like:

PARMLST:=PARMLST TUPLE | TUPLE

TUPLE:= VAR '=' NUM

VAR = non-keyword NUM = number

So this means a PARMLIST consists of another parmlist and a tuple, or just a tuple. A tuple is a variable followed by an equals sign followed by a number. With these rules it's possible to describe most computer languages and stuff. I'm sure SPICE has one, but I haven't been able to find it.

thanks ms

Reply to
63q2o4i02

Seems that would be a function of how closely the software writers adhered to the original Berkeley approach which, IIRC, was written in Fortran. I know that PSpice was re-written in C. I don't know about other SPICE's.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

I doubt that you can. I had a look some time ago, and one stumbling block is the fact that tokens can mean different things depending on where they occur. While it is possible to describe grammers with this property in some scanner/parser generator systems, I doubt that BFN or its ilks will do.

Consider

R R 0 R

which describes a resistor (line starts with 'R') from node R to node 0 with the value R. This is legal in hspice input language and other extensions of the Berkeley Spice input language (expecting a defintion of the value of the parameter 'R,' of course) but makes scanning/parsing a challenge.

I would love to see such a grammar, but didn't find one when I was looking for it.

That said, the original Berkely Spice 2 accepted such a simple input language that a formal description should be possible.

Best Regards

Jens

--
    Key ID 0x09723C12, jensting@tingleff.org
        Analogue filtering / 5GHz RLAN / Mdk Linux / odds and ends
    http://www.tingleff.org/jensting/             +44 1223 211 585
         "Never drive a car when you\'re dead!" Tom Waits
Reply to
Jens Tingleff

"Jens Tingleff" a écrit dans le message de news: snipped-for-privacy@drn.newsguy.com...

is the

While

scanner/parser

with the

the

for

language

We once developped a library maintaining tool and went to exactly the same conclusion.

OTOH I just googled for "spice grammar" + parser and found a message (dated

03/2005) from somebody trying to write one using ANTLR. Maybe you can contact him : simon at icmethods dot com
--
Thanks,
Fred.
Reply to
Fred Bartoli

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.