FB Easy Parser(Update 2018.12.21)

User projects written in or related to FreeBASIC.
Kuan Hsu
Posts: 433
Joined: Sep 16, 2007 15:12
Location: Taiwan

FB Easy Parser(Update 2018.12.21)

Postby Kuan Hsu » Jun 03, 2016 16:57

Hi every body:

I've written a small program can parse freeBASIC code and output json file, the code is a part of my poseidonFB IDE but translated from D to freeBASIC code, I think maybe someone interest in it......^^

It's name is "easy parser" because of it is design for create the AST tree for aucomplete/calltip in my IDE, it lacks error report and syntax analysis isn't very exact, so "EASY" is mean "NOT EXACT"......^^

V0.15:
It can be download at:http://www.mediafire.com/download/8rw4jrd8v13f6ff/parserFB.7z
The sources archive include poseidonFB's project file, it can be easy to read/edit/compile using poseidonFB.
Build with freeBASIC V1.05 32bit(64bit) and IUP 3.21

I think it's easy to read and parse....

enjoy!

( V0.18: Modified parser using in poseidonFB V0.406 )
( V0.17: Modified parser using in poseidonFB V0.328 )
( V0.16: Updated parser using in poseidonFB V0.3+; added document page )
( V0.15: Add "Export Json" )
( V0.14: Big Change! Create AST tree and using GUI to show outline tree (like poseidonFB), updated to poseidonFB rev0.266 version parser )
( V0.13: Add Modified parser about variables and function pointer, updated to poseidonFB rev0.251 using version )
( V0.12: Add "tail" element )
( V0.11: Add "Operator" parser )
( V0.10: First Version )
Image
Image
Last edited by Kuan Hsu on Dec 21, 2018 12:36, edited 16 times in total.
Imortis
Moderator
Posts: 1639
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: FB easy parser

Postby Imortis » Jun 07, 2016 17:44

I just now had a chance to look at your code, and I noticed you made an object called "DynamicArray". I assume this is to get around the limitation in FBC of dynamic arrays not working in UDTs. As of 1.00.0, Dynamic arrays can be used in UDTs.

Am I mistaken? is there another reason for this object?
Kuan Hsu
Posts: 433
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FB easy parser

Postby Kuan Hsu » Jun 08, 2016 14:22

Imortis wrote:I just now had a chance to look at your code, and I noticed you made an object called "DynamicArray". I assume this is to get around the limitation in FBC of dynamic arrays not working in UDTs. As of 1.00.0, Dynamic arrays can be used in UDTs.

Am I mistaken? is there another reason for this object?


HAHA, you are right! I've tried but compiler told me "error 9: Expected expression, found ')' in 'test() as string"...@@, so I change to use the typical way-- malloc the memory and the pointer.

The problem is I use test() as string, not test(any) as string......

Thank you!
aloberoger
Posts: 480
Joined: Jan 13, 2009 19:23

Re: FB easy parser

Postby aloberoger » Jun 09, 2016 11:27

Can I use this parser to build another type of code with freebasic?
for example udt to class converter ?
Kuan Hsu
Posts: 433
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FB easy parser

Postby Kuan Hsu » Jun 09, 2016 11:56

aloberoger wrote:Can I use this parser to build another type of code with freebasic?
for example udt to class converter ?


Feel free for use anywhere/use, just I said: enjoy~
aloberoger
Posts: 480
Joined: Jan 13, 2009 19:23

Re: FB easy parser

Postby aloberoger » Jun 09, 2016 17:48

your example show how to store result in a json file, so it is necessary to know about json file?
Kuan Hsu
Posts: 433
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FB easy parser

Postby Kuan Hsu » Jun 10, 2016 1:24

aloberoger wrote:your example show how to store result in a json file, so it is necessary to know about json file?

The JSON format is easy to read that I think the answer is "YES", the official web is one page:http://www.json.org/
Kuan Hsu
Posts: 433
Joined: Sep 16, 2007 15:12
Location: Taiwan

Re: FB easy parser

Postby Kuan Hsu » Jun 06, 2017 17:49

Dear all:
I update this project today, for
(1)Test poseidonFB is stable or not
(2)Test freeBASIC with IUP 3.21(32bit/64bit)

I rewrite the code to create AST tree instead of out json file, but next version I will enable to create json file.
Feel free to test and use......^^
Image
Tourist Trap
Posts: 2768
Joined: Jun 02, 2015 16:24

Re: FB easy parser

Postby Tourist Trap » Jun 07, 2017 15:52

Kuan Hsu wrote:Feel free for use anywhere/use, just I said: enjoy~

Thanks a lot, I'll try it.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 0 guests