After a bit of fiddling around with what I thought would be a lexical analyzer for Flex, I now realize that the lexer isn’t defined by scan.l, but a combination of one generated from flex.skl, a file that is processed by m4, and the scanner generated by scan.l. Originally, flex.skl included some switches for C …
Author Archives: kaby76
Flex vs Bison import
I’ve written a basic Bison import for Antlrvsix, and now I’m in the guts of writing a Flex import. While writing the Bison import, I soon realized a problem that I could not deal with immediately. Many people write Bison code that is very undisciplined. Often the code contains driver code (calc.y from the official …
Status of transforms for Antlr
I’ve been adding transform/refactoring operations to Antlrvsix for the last two weeks. So far, I have the following: (1) replace parser string literals; (2) remove useless parser rules; (3) move parser start rules to top; (4) reorder parser rules alphabetically; (5) reorder parser rules vis BFS; (6) reorder parser rules DFS; (7) split combined grammars; …
Drivers for any Antlr grammar
This is a placeholder for something I’ve been wanting to do for a while. I’m constantly seeing Antlr grammars posted in Stackoverflow that I want to test out. So, I’d like Antlr4BuildTasks.Templates to include something where you can just copy the grammar files into a directory, then type “dotnet new antlr”, and the damn thing …
Git commits to Antlr vs Bison
While I hunker down here for SARS-CoV-19 to burn itself out (I am in a very high-risk category), I decided to check up on the activity of commits between Antlr and Bison. This is because I read on the Internet that Bison isn’t being actively developed. It turns out, not only is this not true, …
Transformations for Antlr grammars
At this point, I am working on the code for refactoring Antlr grammars in Antlrvsix. While I plan to use Piggy to implement these refactorings, I will first implement them in C# code so I can get a clear picture of what to do with Piggy, make any changes, then rewrite the refactorings using Piggy …
Notes on cleaning up shitty source code
This is just a note to myself on what procedures I take to clean up source code. This occurs because of the basic development cycle in trying to get something to work with complicated APIs, which goes something like this: I search the web to find something that supposedly works, i.e., it was written by …
Parsing Bison grammars with Antlr
I’ve started to write an Antlr grammar for Bison, with the goal of automatically converting the grammars to Antlr, or another parser generator for that matter. As it turns out, the “central dogma” of parsing (i.e., “you cannot use an LR grammar in an LL parser, and vice versa”) is untrue with the unlimited symbol …
Dynamic and Multi-server LSP applications?
Having now implemented an LSP server and two different clients for Antlr, I can say I am more familiar with the LSP protocol. From these implementations, what can I say? LSP works well for single client/single server instances, but I am wondering how I can use LSP in a situation that modifies a workspace, reads …
Continue reading “Dynamic and Multi-server LSP applications?”
Tagging, TextMate, regular and context-free grammars
This is a question I recently asked on a Gitter conversation about LSP and colorization. It’s worth copying it here because there are a number of problems and solutions.