Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collaboration with universal-ctags #9

Open
arichiardi opened this issue Oct 24, 2018 · 3 comments
Open

Collaboration with universal-ctags #9

arichiardi opened this issue Oct 24, 2018 · 3 comments

Comments

@arichiardi
Copy link

Hi @thunknyc,
I so so like the idea of a C reader for one purpose and something I am trying to achieve in my spare time - Clojure static analysis in Emacs.

I am using at the moment universal-ctags but the reader there is very limited.

I used to be a C programmer and I might be able to come up with some hack but I wanted first to open a PR in order to gather some feedback around this crazy idea. Do you think your reader could be used for that purpose against Clojure code?

@edw
Copy link
Member

edw commented Dec 14, 2018

Sorry for not replying sooner. (Addressing me personally via atsign-edw will generally get my attention.) Strangely enough, I've never pumped a Clojure source file through the parser. (Crntl is used to implement a non-Clojure Lisp under iOS.) I don't see why you couldn't do it.

I have no idea what your project entails, but I suppose you'd benefit from something that translates EDN/Clojure source to something closer to pure pair-based s-expressions. Is that the case? If so I am currently writing a Scheme dialect atop Chibi Scheme, and I've written an EDN/Clojure parser in it. That parser emits just the sort of s-expressions you might want. It doesn't support every aspect of Clojure syntax at the moment -- notably syntax-quoting, the deref sugar, and maybe a couple other obscurities.

The code of which I speak is available at thunknyc/i7t.

@arichiardi
Copy link
Author

Hi there!

First of all thanks for answering!

Yes you are on the right track cause basically the goal for me would be to have some sort of AST that I can then traverse in order to trigger universal-ctags's tag creation functions like:

static void makeFunctionTag (vString * const name, const char *dbp, int scope_index)
{
	functionName (name, dbp);
	if (vStringLength (name) > 0 && ClojureKinds[K_FUNCTION].enabled)
	{
		tagEntryInfo e;
		initTagEntry (&e, vStringValue (name), K_FUNCTION);
		e.lineNumber = getInputLineNumber ();
		e.filePosition = getInputFilePosition ();

		e.extensionFields.scopeIndex =  scope_index;
		makeTagEntry (&e);
	}
}

Basically the info I'd need is kind of line/column + name and reader type of what it has been read.

It seems like this project would fit more but the other one wrote on top of chibi looked definitely something worth reading (I was actually exploring that scheme for a bit).

My long term goal would be to have fast static analysis for Clojure files. I was thing about using the ClojureScript analyzer as well at some point.

@edw
Copy link
Member

edw commented Dec 14, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants