ashalkhakov / libatsc

ATS/C libraries
MIT License
3 stars 0 forks source link

taggen for ATS #7

Open ashalkhakov opened 4 years ago

ashalkhakov commented 4 years ago

https://docs.google.com/document/d/10nItDoBFchCblgk6BglcbMrv7qDHOymbfu8j_C8RFNU/edit

learn how to use it!

or, make a better tool out of that. seriously.

--taggen outputs JSON for a given sats or a dats file

{"tagfile": "full-path-to-the-file", "tagentarr": [X]}

where X = {"name": "name-of-the-symbol", "nline": 1, "nchar": 1}

https://github.com/alex-ren/org.ats-lang.toolats/tree/master/org.ats-lang.toolats/src/org/ats_lang/toolats/taggen

converts this JSON to something palatable

actually.

a tool to do queries over the symbols

we can put what we have into a table and use sqlite for everything else :)

file(id,filepath) // some id for every source file
symbol_location(symbol, file_id, line,col,offset) // where symbol is declared

SELECT file_id,line,col,offset  FROM symbol_location WHERE symbol=? // get location by symbol

basically, for all *.(s|d)ats files in a directory, run the taggen tool and add up all results to a TAGS file

https://www.emacswiki.org/emacs/TagsFile#tags_file

we could also start with a TCP server that follows something similar to the purescript IDE protocol: https://github.com/purescript/purescript/blob/master/psc-ide/PROTOCOL.md

JSON over simple TCP single line of json input, ended by a newline then it gives back a response again with a single line, terminated by a newline and closes the connection

example servers:

I guess we could even use the compiler as a library and embed it into this server

ashalkhakov commented 4 years ago

https://github.com/alyptik/cepl