• Prolog Implementation for Parsing

    From Josh Cho@joshchonpc@gmail.com to comp.lang.prolog on Fri Oct 27 21:39:34 2023
    From Newsgroup: comp.lang.prolog

    Fairly new here. I am trying to use Prolog for parsing and analyzing code. Essentially I want to flatten the AST into facts so that with rules, I may query over them. I want to parse Clojure atm, but would like something general. Which Prolog implementations are appropriate?
    Also relevant is this article: https://marcellerusu.com/using_prolog_as_the_ast.html
    Sincerely,
    Josh Cho
    Stanford B.S./M.S. in Computer Science
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From peter.l...@gmail.com@peter.ludemann@gmail.com to comp.lang.prolog on Sat Oct 28 10:03:43 2023
    From Newsgroup: comp.lang.prolog

    There's a rather old paper: "Logic Programming and Compiler Writing" by David H.D. Warren. Also Peter Van Roy's PhD thesis on the "Aquarius" compiler.
    See also Abrahams and Dahl "Logic Grammars" (you can find some simple code for DCTGs on the internet, although it's a somewhat slow implementation).
    I wrote some code for processing Python ASTs: https://github.com/kamahen/pykythe (pykythe.pl, predicate kynode)..
    It has what looks like a big pattern-matching "case" statement on the various AST node types. I intend to rewrite this code somewhat, using a newer way of handling accumulators (https://swi-prolog.discourse.group/t/dealing-with-state/6866/10 but modified to use "records" instead of "dicts" (https://swi-prolog.discourse.group/t/dealing-with-state/6866/50).
    You might find it more productive to discuss in https://swi-prolog.discourse.group rather than here.
    On Friday, October 27, 2023 at 9:39:36 PM UTC-7, Josh Cho wrote:
    Fairly new here. I am trying to use Prolog for parsing and analyzing code. Essentially I want to flatten the AST into facts so that with rules, I may query over them. I want to parse Clojure atm, but would like something general. Which Prolog implementations are appropriate?

    Also relevant is this article: https://marcellerusu.com/using_prolog_as_the_ast.html

    Sincerely,
    Josh Cho

    Stanford B.S./M.S. in Computer Science
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Julio Di Egidio@julio@diegidio.name to comp.lang.prolog on Sat Oct 28 16:10:37 2023
    From Newsgroup: comp.lang.prolog

    On Saturday, 28 October 2023 at 19:03:45 UTC+2, peter.l...@gmail.com wrote:
    On Friday, October 27, 2023 at 9:39:36 PM UTC-7, Josh Cho wrote:
    Fairly new here. I am trying to use Prolog for parsing and analyzing code. Essentially I want to flatten the AST into facts so that with rules, I may query over them. I want to parse Clojure atm, but would like something general. Which Prolog implementations are appropriate?

    Also relevant is this article: https://marcellerusu.com/using_prolog_as_the_ast.html

    There's a rather old paper: "Logic Programming and Compiler Writing" by David H.D. Warren. Also Peter Van Roy's PhD thesis on the "Aquarius" compiler.
    See also Abrahams and Dahl "Logic Grammars" (you can find some simple code for DCTGs on the internet, although it's a somewhat slow implementation).
    Parsing is a typical application for Prolog and there is a ton of material available online at all levels: <https://start.duckduckgo.com/?q=Prolog+parsing+AST>
    I wrote some code for processing Python ASTs: https://github.com/kamahen/pykythe (pykythe.pl, predicate kynode)..
    It has what looks like a big pattern-matching "case" statement on the various AST node types. I intend to rewrite this code somewhat, using a newer way of handling accumulators (https://swi-prolog.discourse.group/t/dealing-with-state/6866/10 but modified to use "records" instead of "dicts" (https://swi-prolog.discourse.group/t/dealing-with-state/6866/50).

    You might find it more productive to discuss in https://swi-prolog.discourse.group rather than here.
    Ah, now I see what job you are here for...
    *Troll Alert*
    Julio
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From peter.l...@gmail.com@peter.ludemann@gmail.com to comp.lang.prolog on Sat Oct 28 16:18:22 2023
    From Newsgroup: comp.lang.prolog

    On Saturday, October 28, 2023 at 4:10:39 PM UTC-7, Julio Di Egidio wrote:
    On Saturday, 28 October 2023 at 19:03:45 UTC+2, peter.l...@gmail.com wrote:
    On Friday, October 27, 2023 at 9:39:36 PM UTC-7, Josh Cho wrote:
    Fairly new here. I am trying to use Prolog for parsing and analyzing code. Essentially I want to flatten the AST into facts so that with rules, I may query over them. I want to parse Clojure atm, but would like something general. Which Prolog implementations are appropriate?

    Also relevant is this article: https://marcellerusu.com/using_prolog_as_the_ast.html

    There's a rather old paper: "Logic Programming and Compiler Writing" by David H.D. Warren. Also Peter Van Roy's PhD thesis on the "Aquarius" compiler.
    See also Abrahams and Dahl "Logic Grammars" (you can find some simple code for DCTGs on the internet, although it's a somewhat slow implementation).
    Parsing is a typical application for Prolog and there is a ton of material available online at all levels: <https://start.duckduckgo.com/?q=Prolog+parsing+AST>
    I wrote some code for processing Python ASTs: https://github.com/kamahen/pykythe (pykythe.pl, predicate kynode)..
    It has what looks like a big pattern-matching "case" statement on the various AST node types. I intend to rewrite this code somewhat, using a newer way of handling accumulators (https://swi-prolog.discourse.group/t/dealing-with-state/6866/10 but modified to use "records" instead of "dicts" (https://swi-prolog.discourse.group/t/dealing-with-state/6866/50).

    You might find it more productive to discuss in https://swi-prolog.discourse.group rather than here.
    Ah, now I see what job you are here for...

    *Troll Alert*
    Nope - it's just that I don't read comp.lang.prolog often, but do read https://swi-prolog.discourse.group (moved from https://groups.google.com/g/swi-prolog), which is officially about SWI-Prolog but often has more general discussion about Prolog.
    (I miss the good old days of the "Prolog Digest" with Chuck Restivo, The Moderator)
    - peter

    Julio
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Julio Di Egidio@julio@diegidio.name to comp.lang.prolog on Sat Oct 28 16:24:49 2023
    From Newsgroup: comp.lang.prolog

    On Sunday, 29 October 2023 at 01:18:24 UTC+2, peter.l...@gmail.com wrote:
    On Saturday, October 28, 2023 at 4:10:39 PM UTC-7, Julio Di Egidio wrote:
    On Saturday, 28 October 2023 at 19:03:45 UTC+2, peter.l...@gmail.com wrote:
    <snip>
    You might find it more productive to discuss in https://swi-prolog.discourse.group rather than here.

    Ah, now I see what job you are here for...

    *Troll Alert*

    Nope - it's just that I don't read comp.lang.prolog often, but do read https://swi-prolog.discourse.group (moved from https://groups.google.com/g/swi-prolog), which is officially about SWI-Prolog but often has more general discussion about Prolog. (I miss the good old days of the "Prolog Digest" with Chuck Restivo, The Moderator)
    I don't believe you, especially considering the actual history and why we are where we are. Anyway, as an old timer, you should at least know that pointing users somewhere else is very poor etiquette to say the least: especially since I for one am still around here and kicking, in fact almost the only active user left.
    But I'm an optimist, I might be wrong: let's see what happens next.
    Julio
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Mild Shock@bursejan@gmail.com to comp.lang.prolog on Sun Nov 5 13:02:10 2023
    From Newsgroup: comp.lang.prolog


    Says the guy with no brains, who even doesnt understand
    simple call/1 examples. The contrary of alive and kicking.
    More a brain dead Prolog zombie about to desintegrate.
    LoL
    Julio Di Egidio schrieb am Sonntag, 29. Oktober 2023 um 01:24:50 UTC+2:
    On Sunday, 29 October 2023 at 01:18:24 UTC+2, peter.l...@gmail.com wrote:
    On Saturday, October 28, 2023 at 4:10:39 PM UTC-7, Julio Di Egidio wrote:
    On Saturday, 28 October 2023 at 19:03:45 UTC+2, peter.l...@gmail.com wrote:
    <snip>
    You might find it more productive to discuss in https://swi-prolog.discourse.group rather than here.

    Ah, now I see what job you are here for...

    *Troll Alert*

    Nope - it's just that I don't read comp.lang.prolog often, but do read https://swi-prolog.discourse.group (moved from https://groups.google.com/g/swi-prolog), which is officially about SWI-Prolog but often has more general discussion about Prolog. (I miss the good old days of the "Prolog Digest" with Chuck Restivo, The Moderator)
    I don't believe you, especially considering the actual history and why we are where we are. Anyway, as an old timer, you should at least know that pointing users somewhere else is very poor etiquette to say the least: especially since I for one am still around here and kicking, in fact almost the only active user left.

    But I'm an optimist, I might be wrong: let's see what happens next.

    Julio
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Mild Shock@bursejan@gmail.com to comp.lang.prolog on Sun Nov 5 13:12:05 2023
    From Newsgroup: comp.lang.prolog


    Culio is as brain dead as LogNonsenseTalk.
    These negation tests are also rather minimal: https://github.com/LogtalkDotOrg/logtalk3/tree/master/tests/prolog/predicates/not_1
    Understandable, if \+ is bootstrapped as specified
    the unit test for call/1, etc.. should suffice. More test
    cases are only needed if one is sceptical about the
    bootstrapping of \+ or its compilation. Currently in
    the process of creating more „Novacore“ test cases.
    Unfortunately the domain www.novacore.ch wasn‘t
    available anymore, so I went for:
    www.novacuor.ch
    Mild Shock schrieb am Sonntag, 5. November 2023 um 22:02:12 UTC+1:
    Says the guy with no brains, who even doesnt understand
    simple call/1 examples. The contrary of alive and kicking.

    More a brain dead Prolog zombie about to desintegrate.

    LoL
    Julio Di Egidio schrieb am Sonntag, 29. Oktober 2023 um 01:24:50 UTC+2:
    On Sunday, 29 October 2023 at 01:18:24 UTC+2, peter.l...@gmail.com wrote:
    On Saturday, October 28, 2023 at 4:10:39 PM UTC-7, Julio Di Egidio wrote:
    On Saturday, 28 October 2023 at 19:03:45 UTC+2, peter.l...@gmail.com wrote:
    <snip>
    You might find it more productive to discuss in https://swi-prolog.discourse.group rather than here.

    Ah, now I see what job you are here for...

    *Troll Alert*

    Nope - it's just that I don't read comp.lang.prolog often, but do read https://swi-prolog.discourse.group (moved from https://groups.google.com/g/swi-prolog), which is officially about SWI-Prolog but often has more general discussion about Prolog. (I miss the good old days of the "Prolog Digest" with Chuck Restivo, The Moderator)
    I don't believe you, especially considering the actual history and why we are where we are. Anyway, as an old timer, you should at least know that pointing users somewhere else is very poor etiquette to say the least: especially since I for one am still around here and kicking, in fact almost the only active user left.

    But I'm an optimist, I might be wrong: let's see what happens next.

    Julio
    --- Synchronet 3.20a-Linux NewsLink 1.114