-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to have an optional first line? #320
Comments
Hi @prokie, To fill me in, could you please give me an example of the beginning of an input, your new parser should be able to parse? This could help me to understand the situation. |
Ok, I did some Internet research.
|
Oh, I actually messed up. The first line in a spice netlist is always the title. So I somehow need to have parol match the first line of the file to the
|
Understood. Just a shot:
Keep one thing in mind: |
Here is a starting point.
|
Thanks for the starting point, I am still struggling with what I currently have, but the starting point is great for reference. I will continue to work on it. I will let you know if I have any questions. Thanks again. |
I think you have to modify a few things to make this parser work. |
Hi, again. I made my problem smaller to try and get a better starting point. But I dont really know how to get around the following issue. I am only using resistor now and just skipped the nodes and identifiers, I guess, somehow I need to tell to parser to not look for another title after finding the first one.
This gives me the error that it expected R1 to be a title. |
Yes, I understand. |
Hi @prokie here is a grammar that worked for me with your first example.
Keep in mind that you have to extract the first identifier (which comes directly after the r, c, l, v, i part) in your grammar processing from the token's text itself. |
I close the issue. |
Hi!
I am new to parsing and trying to learn by writing a spice netlist parser. In the first line of a spice netlist, there is an optional title string that gives the title to the circuit. How would I write that in my parole grammar file?
This is what I have so far.
The text was updated successfully, but these errors were encountered: