Pet project, work in progress. An experimental "semantic" ast parser: https://github.com/davidberneda/TeeParser/blob/master/TeePascal.pas

Pet project, work in progress. An experimental "semantic" ast parser: https://github.com/davidberneda/TeeParser/blob/master/TeePascal.pas

Comments

  1. Haven't used Roman's excelent project. I've been playing with the idea of parsing code and validating each item correctness (ie, "a:=b" is valid if a and b are of compatible types), similar to a compiler's front-end part. Tree nodes are objects representing each atomic code (TFor, TVariable, TUnit..,and so on).

    ReplyDelete
  2. I think you two should work together. Product proliferation is only good if they are really different. I've the impression both libraries are too close.

    ReplyDelete
  3. shlomo abuisak I've added a simple demo. The "browse" dialog shows Pascal code emitted from the internal objects (not loaded from the original source files).

    ReplyDelete
  4. Jeroen Wiert Pluimers I agree ! but my code is just a v0.1, a bunch of dirty experiments, mainly used to detect new compiler syntax, rtl intrinsics, etc

    ReplyDelete
  5. Roman Yankovsky Jeroen Wiert Pluimers The idea of this (ugly done ) project is to parse from the very low level Sysinit.pas up, then the generated ast can be saved to a file for later reload (so no need to parse any source anymore).  The ast is language-agnostic, any branch can be "emitted" to Pascal text again (or other language capable of supporting the ast nodes info).

    ReplyDelete
  6. David Berneda in my experience, emitting code isn't the problem. Parsing is. Hence my suggestion (;

    ReplyDelete

Post a Comment