Where can I find LexerGrammar API in ANTLR - antlr4

I would like to use LexerInterpreter in the ANTLR as in below link
https://theantlrguy.atlassian.net/wiki/display/ANTLR4/Parser+and+lexer+interpreters
However, with ANTLR4 runtime assemblies (.Net), LexerGrammar and Grammar APIs are not recognized. Where can I find them ? Did I miss any reference assemblies.
Thank You,

Related

What does access$ mean in an android studio project?

I really do not understand that, I'm a beginner in programming.
For example:
StartActivity.access$202(StartActivity.this, 0);
or
StartActivity.a|ccess$402(StartActivity.this, true ^ StartActivity.this.gl_bShowConfig);
The $ character is used in mechanically generated source code or, rarely, to access pre-existing names on legacy systems.
See Java specs: https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8

Antlr4 Python3 target visitor not usable?

I try to follow the Antlr4 reference book, with the Python3 target, but I got stuck in the calculator example. On the Antlr4 docs it says
The Python implementation of AntLR is as close as possible to the Java one, so you shouldn't find it difficult to adapt the examples for Python
but I don't get it yet.
The java code visitor has a .visit method and in python I don't have this method. I think it's because in java the visit method had parameter overloads of the tokens. In python we have visitProg(), visitAssign(), visitId() etc. But now I can't write value = self.visit(ctx.expr()) because we don't know what visit to call?
Or am I missing an instruction somewhere?
Looks like sometime in the last 3+ years this was fixed. I generated a parser from a grammar and targeted Python 3, using:
antlr4 -Dlanguage=Python3 -no-listener -visitor mygrammar.g4
It generates a visitor class that subclasses ParseTreeVisitor, which is a class in the antlr4-python3-runtime. Looking at the ParseTreeVisitor class, there is a visit method.
For those interested in working through the The Definitive ANTLR 4 Reference using Python, the ANTLR4 documentation points you towards this github repo:
https://github.com/jszheng/py3antlr4book
The Python2/3 targets do not yet have a visitor implemented. I tried to implement it myself, and a pull request is send to that antlr guy to see if I did it correctly. Follow the pull request here: https://github.com/antlr/antlr4-python3/pull/6

What's the difference between the macros _MANAGED and _cplusplus_cli?

The MS docs (even back in 2005) state for both:
_MANAGED : Defined to be 1 when /clr is specified.
__cplusplus_cli: Defined when compiling with /clr, /clr:pure, or /clr:safe. (...)
So if I'm compiling a C++/CLI module and need to check, which one should I use?
The answer is mentioned here:
both macros are supposed to be defined if the /clr option is
specified. Are you perchance using /clr:oldSyntax? In that case,
you're targeting Managed C++, not C++/CLI
And indeed, when looking at the 2003 docs there is only _MANAGED and there is no C++/CLI there yet.
To answer which one should I use, I'd say it doesn't really matter unless you need to differentiate between oldSyntax and CLI.

Strange CLR compilation

So I'm doing this DirectX 11 project and had to use ...array<T>^ arr from the System header and I had to switch my Common Language RunTime Support settings to /clr. After fiddling with the other setting to get the project to compile I seem to have messed something up ,because now I cant use breakpoints and all the objects I have seem to not exist I dont know how else to put it. Please help.
Unless you need to work with .NET types, I'd recommend not using /CLR. Instead of using array<T>^, you can just use std::vector<T> and eliminate the dependency on the common language runtime.

T4 Template Processing Error: "Failed to resolve type for directive processor <directive processor name>."

So I've been having this really nasty error that I've been trying to get rid of for the past couple of days...
I have a T4 template that I run in the debugging solution of a Domain Specific Language (DSL) that I'm building (let's assume it's called MyDsl :P). I have this as the template header:
<## template inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" #>
<## output extension=".txt" #>
<## MyDsl processor="MyDslDirectiveProcessor" requires="fileName='Sample.mydsl'" #>
The issue is caused by the custom directive, which prevents template generation because it "Failed to resolve type for directive processor MyDslDirectiveProcessor." When I remove the custom directive to try to see if the error depends on something else, I get an error in the first (template) directive, that ModelingTextTransformation does not exist in the namespace Microsoft.VisualStudio.TextTemplating.VSHost.
This also happens with the automatically-added templates in this debugging solution, since they contain these same code lines.
Help is appreciated :)
P.S: I use Visual Studio 2012. Also, possible similar question here.
So apparently I accidentally renamed my project name in DSL Explorer...I was probably naming something else and my computer went stupid on me without me realizing it.

Resources