Incoming source code... (Bison script based on IEC 61131-3 Annex B contents)

  • Thread starter Campbell, David (Ex AS17)
  • Start date
C

Thread Starter

Campbell, David (Ex AS17)

According to http://www.linuxplc.org/doc/cvs.html I need an appropriate username on linuxplc.org to add code to the CVS tree (there is a comment about using a default account for read only access). Just a couple of warnings about the attached file:

a) The file is only the BISON skeleton, there is
active code attached. Nor is there a yylex routine
defined (this only needs to pass single chars to
the main BISON script).

b) Annex B does not specify how to handle embedded
whitespace. This is documented in section 2.1.4
of the main document but I wanted to push the
first draft out now. Hopefully correct whitespace
handling should fix the remaining 142 reduce/reduce
conflicts (ouch!)

David Campbell
 
Campbell, David (Ex AS17):
> According to http://www.linuxplc.org/doc/cvs.html I need an appropriate
> username on linuxplc.org to add code to the CVS tree (there is a comment
> about using a default account for read only access).

Yes. BTW (and this is mostly for others listening), if you can use the read-only CVS, the output of "cvs diff -u" is just about the preferred format for submitting patches, because it lets us know exactly what version you started from. (If you can't, don't worry about it, a "diff -u" is almost as good.)

Other than that, make yourself a subdirectory under /logic and go ahead!

> Just a couple of warnings about the attached file:

> a) The file is only the BISON skeleton, there is active code attached.
> Nor is there a yylex routine defined (this only needs to pass single
> chars to the main BISON script).

Any reason why you aren't using (f)lex? I thought that's the usual pairing...

(Certainly a lot of it would be much easier to read if it was in flex syntax - for instance the definition of letter would be "[a-zA-Z]".)

Jiri
--
Jiri Baum <[email protected]>
What we do Every Night! Take Over the World! Step 1 - bid for SMOFcon

_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
 
D

David Campbell

Curt,

Bison/Yacc scripts are an exercise in metal gymnastics. (especially after translating 13 pages of syntax mush).

I am slowly working the conflicts out of the scripts so (so far 3 clear faults in the IEC standard which require some modification to obtain a workable parser) tomorrow I will "hopefully" be able to update the CVS sources
with a better copy (and add some flesh to the skeleton).

David Campbell

_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
 
C

Campbell, David (Ex AS17)

Jiri wrote:

> Any reason why you aren't using (f)lex? I thought that's the usual
> pairing...
>
> (Certainly a lot of it would be much easier to read if it was in flex
> syntax - for instance the definition of letter would be "[a-zA-Z]".)

Previous exposure to Bison, I will give flex a try as there a couple of problems with Bison which make things "difficult".

David Campbell

_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
 
Just in case I wasn't clear, what I was asking about is a flex-bison combination. Normally flex is used to turn characters into tokens (words,
numbers etc), and then bison parses those tokens.

flex on its own isn't really powerful enough to parse a hierarchical structure.


Jiri
--
Jiri Baum <[email protected].com.au>
What we do Every Night! Take Over the World! Step 1 - bid for SMOFcon

_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
 
C

Campbell, David (Ex AS17)

Jiri wrote:
>>> Any reason why you aren't using (f)lex? I thought that's the usual
>>> pairing...
>...
>> Previous exposure to Bison, I will give flex a try as there a couple of
>> problems with Bison which make things "difficult".
>
> Just in case I wasn't clear, what I was asking about is a flex-bison
> combination. Normally flex is used to turn characters into tokens (words,
> numbers etc), and then bison parses those tokens.
>
> flex on its own isn't really powerful enough to parse a hierarchical
> structure.

You must of missed my off list email where I said:
"Thanks, I am now looking at a combo" (words to that effect).

My background is Chemical Engineering so much of what I know is self taught. If you read through the Bison info pages there is no mention to Flex but the Flex documentation mentions Bison.

Again, thanks for pointing out Flex. I am in the middle of ripping out large chuncks of Bison code and placing it into a Flex front end routine. A lot of the "Shift/Reduce" conflicts are vanishing and the whitespace issue should vanish.

David Campbell


_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
 
Top