ENIGMA Forums

General fluff => Announcements => Topic started by: Josh @ Dreamland on January 06, 2012, 09:48:41 am

Title: Neat Stuff
Post by: Josh @ Dreamland on January 06, 2012, 09:48:41 am
I was working on this new parser yesterday, and I thought it'd be kind of neat to make my AST generator export SVGs. So I did.

So, given this expression: 2 << 1 + 6 / 2 - 2 / 2 << 8 % 5 + 5 / 2

The AST looks like this, step by step:

ast << create_token_dec_literal("2",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_00.svg.png)

ast << create_token_operator("<<",2);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_01.svg.png)

ast << create_token_dec_literal("1",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_02.svg.png)

ast << create_token_operator("+",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_03.svg.png)

ast << create_token_dec_literal("6",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_04.svg.png)

ast << create_token_operator("/",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_05.svg.png)

ast << create_token_dec_literal("2",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_06.svg.png)

ast << create_token_operator("-",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_07.svg.png)

ast << create_token_dec_literal("2",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_08.svg.png)

ast << create_token_operator("/",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_09.svg.png)

ast << create_token_dec_literal("2",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_10.svg.png)

ast << create_token_operator("<<",2);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_11.svg.png)

ast << create_token_dec_literal("8",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_12.svg.png)

ast << create_token_operator("%",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_13.svg.png)

ast << create_token_dec_literal("5",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_14.svg.png)

ast << create_token_operator("+",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_15.svg.png)

ast << create_token_dec_literal("5",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_16.svg.png)

ast << create_token_operator("/",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_17.svg.png)

ast << create_token_dec_literal("2",1);
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_18.svg.png)


neathuh
Title: Re: Neat Stuff
Post by: Rusky on January 06, 2012, 09:50:53 am
Very nice!
Title: Re: Neat Stuff
Post by: Fede-lasse on January 06, 2012, 10:05:24 am
ASTs are neat.

(http://digitocero.com/include/exportar-y-visualizar-el-arbol-sintactico-abstractoast-de-gcc/tree.png)
Title: Re: Neat Stuff
Post by: Josh @ Dreamland on January 06, 2012, 02:46:11 pm
Chickens are neat.

(http://www.itsnature.org/wp-content/uploads/2008/02/ostrich-in-addo-park-eastern-cape-south-africa-wl.jpg)
Title: Re: Neat Stuff
Post by: IsmAvatar on January 06, 2012, 02:53:46 pm
(http://dl.dropbox.com/u/1052740/enigma/screens/renders/AST_Gneration/early/PNG/AST_18.svg.png)
(http://www.itsnature.org/wp-content/uploads/2008/02/ostrich-in-addo-park-eastern-cape-south-africa-wl.jpg)

Having trouble seeing a difference here...

Title: Re: Neat Stuff
Post by: Josh @ Dreamland on January 06, 2012, 02:54:40 pm
The second picture has grass in it.
Title: Re: Neat Stuff
Post by: IsmAvatar on January 06, 2012, 02:55:02 pm
Ah. k