Restored from previous forum. Originally posted by cor.
My current project is to make graphical flowcharts from a Purebasic source.
Has someone suggestions to parse the basic keywords such as:
for:next
gosub: return
if:else:elseif:endif
repeat:until
select:endselect
while:wend
goto
I'am not asking for a complete working source but a way to do such a parsing, including 1 or many nested keywords.
Suggestions are welcome
Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
Prsing basic keywords
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)
Well, the syntax highlighting in the editor may do something similar to what you need. Also, you might want to take a look at my pb2html tool which parses PB source and does syntax highlighting (in HTML) - you can get the source for that on the resources site.Originally posted by cor
My current project is to make graphical flowcharts from a Purebasic source.
Has someone suggestions to parse the basic keywords such as:
--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
But if Cor is making a flowchart then is not like syntaxis highlight because he needs to get the flow of the code if i understand well what is he doing.
Can you give us an example of what kind of result that you expect your app to give?
Best Regards
Ricardo
Dont cry for me Argentina...
But if Cor is making a flowchart then is not like syntaxis highlight because he needs to get the flow of the code if i understand well what is he doing.
Can you give us an example of what kind of result that you expect your app to give?
Best Regards
Ricardo
Dont cry for me Argentina...
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> Can you give us an example of what kind of result that you expect your app to give?
I assume it's something like this Visual Basic product:
http://www.aivosto.com/visustin.html
Also, please see this URL as it will give you a starting point:
viewtopic.php?t=2273
> Can you give us an example of what kind of result that you expect your app to give?
I assume it's something like this Visual Basic product:
http://www.aivosto.com/visustin.html
Also, please see this URL as it will give you a starting point:
viewtopic.php?t=2273
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Very nice idea to build one for PB.
This one works with BASIC too, but since PB is a little different i dont know...
http://www.fatesoft.com/s2f/feature.htm
However the idea to parse a code is very interesting and could be usefull for many applications.
How it could be done?
Best Regards
Ricardo
Dont cry for me Argentina...
Very nice idea to build one for PB.
This one works with BASIC too, but since PB is a little different i dont know...
http://www.fatesoft.com/s2f/feature.htm
However the idea to parse a code is very interesting and could be usefull for many applications.
How it could be done?
Best Regards
Ricardo
Dont cry for me Argentina...
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
What you do after that is different. For example, instead of printing out the code with colour information (syntax highlight) it could be stored in a linked list / array / whatever.
--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)
Both syntax highlighting and making flowcharts from code can easily share the first step which would be to take the source code and separate it out into keywords, tokens and other text.Originally posted by ricardo
But if Cor is making a flowchart then is not like syntaxis highlight because he needs to get the flow of the code if i understand well what is he doing.
What you do after that is different. For example, instead of printing out the code with colour information (syntax highlight) it could be stored in a linked list / array / whatever.
--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by cor.
Here is a screenshot of my first alpha-alpha test for flowcharting PB sources.
It is going to be Procedure minded. So you can quikly do a flowchart for a given procedure.
Also the the idle loop can be flowcharted
Output can now be copied to clipboard for pasting into e.g. Word(Pad).
So easy resizing can be done.
I'am not using the standard way for parsing sources, but an easy new technique (idea by myself -is in experimental fase now) because the standard technique was much to difficult for me.
It's a whole different approach for analyzing sources.
If I can get it completely to work (for my flowcharting program), i will make it public to the forum. All is done by a couple of Dim's
Suggestions are welcome for things like:
+ option for displaying vars (on/off)
+ option for diplaying comments (on/off)
Click below for a screenshot:
http://www.chordplanet.com/purebasic/flowchart.gif
Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
Here is a screenshot of my first alpha-alpha test for flowcharting PB sources.
It is going to be Procedure minded. So you can quikly do a flowchart for a given procedure.
Also the the idle loop can be flowcharted
Output can now be copied to clipboard for pasting into e.g. Word(Pad).
So easy resizing can be done.
I'am not using the standard way for parsing sources, but an easy new technique (idea by myself -is in experimental fase now) because the standard technique was much to difficult for me.
It's a whole different approach for analyzing sources.
If I can get it completely to work (for my flowcharting program), i will make it public to the forum. All is done by a couple of Dim's
Suggestions are welcome for things like:
+ option for displaying vars (on/off)
+ option for diplaying comments (on/off)
Click below for a screenshot:
http://www.chordplanet.com/purebasic/flowchart.gif
Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm