Java Symbol Solver, any book on how it is developed?

I’m developing a language semantically similiar to Java and C#, but it’s different in some aspects (e.g. it is a VBScript dialect). I’m used to create parsers based on the projects Luaparse and Esprima since some years. I already know about the JavaParser and Roslyn projects, but the way they implement semantic data model and symbol resolution seems tough for me. So far I was able to implement symbol solver sometimes, but I never got to resolve generics very well (for example, type parameter constraints, or bounds; my previous project contains a symbol solver). I’m lacking good terminology (and sense) in regards to symbol solver.

When I google about “creating symbol solver” I unfortunately end up in mathematics subjects, which has nothing to do with programming language’s symbol solver, so I appreciate if someone can give me a direction.

To be more specific, when I refer to symbol resolution, I mean solving entire sequence of programs (sharing modules aka packages/namespaces). But it could also possible to verify specific AST nodes (not necessarily a program).

Currently I’m developing a symbol solver for this VBScript dialect (link), but I’m perplexed for not being sure whether to support type constraints within type parameters or not.

1 Like

Hi @hydroper and welcome to the community.

I wrote a project called Java Symbol Solver which was later merged into JavaParser. Unfortunately I did not find much useful material on this topic. I think it is a very niche topic. Generics were VERY difficult to handle, and besides reading the Java Language Specifications I did not find much help :frowning:

1 Like

@ftomasseti Thanks for the response! I’ve not considered reading the Java Language Specification, but it seems more logical than pratical. Guess I’ll have to think a bit. I’m not needing type parameter bounds, but it’d be really nice to be fully-featured

There’s Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages by Terence Parr from Terence Parr. He writes pretty well, and aims for non-academics. Like me. A problem is that the version of ANTLR that he uses all the time is an outdated one, that makes it a bit awkward to follow. I don’t think he touches generics, but he does do symbol solving and code generation for a small OO language, so it should give you ideas and terminology.

3 Likes