RomanYankovsky / DelphiAST

Abstract syntax tree builder for Delphi
Mozilla Public License 2.0
273 stars 117 forks source link

AST binary (de)serialization #204

Closed gabr42 closed 7 years ago

gabr42 commented 7 years ago

Hi there!

I wrote a class that serializes AST to a stream and deserializes it back.

Also modified: added TSyntaxTreeWriter.ToBinary which forwards request to the binary serializer.

Currently the code probably works only in Delphi as it uses a TDictinary<>. Other than that there should be no FPC incompatibilities.

RomanYankovsky commented 7 years ago

Very interesting. I just wonder, what do you use this for? What's your application of DelphiAST?

gabr42 commented 7 years ago

I started work on a project indexer and indexing 10000 units every time you need some information is a bit sloooow ... The rest is, for the moment, confidential :) (although, with some luck, everything will be open sourced when half ready).

OTOH, I found out that I won't need this serialization directly after I wrote serializer ;) but I still decided to complete the work (deserializer) and make my contribution to the project.

gabr42 commented 7 years ago

Moved DelphiAST.Serialize.Binary to the Source folder ...

Wosi commented 7 years ago

Nice, I'll have a look at it when I find the time.

Currently the code probably works only in Delphi as it uses a TDictinary<>. Other than that there should be no FPC incompatibilities.

The FPC version of Generics.Collections is already a submodule in this repository. There should only be two small things to change in your code for FPC support

  1. Add {$IFDEF FPC}{$MODE DELPHI}{$ENDIF} to the top of the new units.
  2. Replace System.Generics.Collections with Generics.Collections in the uses sections.
RomanYankovsky commented 7 years ago

Thanks!

gabr42 commented 7 years ago

Closed but not merged?

RomanYankovsky commented 7 years ago

Sorry, my bad :)