Welcome, Guest |
This public forum is meant for questions and discussions about Visual FoxPro
TOPIC:
Fox developper "UNBOXING XSHARPDEV " experience 25 Apr 2022 15:10 #22302
|
I want to share an experience with the Xsharp Forum. A bug in the latest revision v2.11.0.1 made me wonder why what happened? (a confusion between variables, free procedures, class methods and arrays that at first I reported as a warning and then I realized that it was a very important error that triggered my alerts. For more details follow the following link Warning, not error: incorrect confuse a method with a field or memvar. · Issue #988 · X-Sharp/XSharpPublic (github.com) As to my modest understanding the problem was in the compiler, I downloaded XSharpDev from GitHub and began to try to understand it since it contains a gigantic accumulation of culture poured out by Robert (no one is surprised at this point if I say he is a genius, right?) I began to absorb culture via the XSharpDev project and from there the next title emerges. If you continue reading keep in mind that there may be gigantic mistakes because I am trying to tell the experience of learning, know how to excuse them and please do not hesitate to observe them to continue learning Unboxing XsharpDev. How is the XSharp language built? Physically the main project of XSHARPDEV is XSharp.CodeAnalysis.dll (there is a similar one for c# developed by MS), this is the "Heracles" of this story, the program written by Robert in C# where all own and third-party components are integrated. Robert uses resources from the Open Source community and if they are not enough he simply creates his own. Particularly for the bug I mentioned at the beginning Robert modified XSharp/src/Compiler/XSharpCodeAnalysis/Binder/Binder_Invocation.cs, This is the link for the most curious, although at this point it is almost an anecdote: . What are the main components? I reiterate my apologies if I'm wrong, I continue to order parts according to the following criteria: what I think is most important first:
VFP programmers never need anything other than FoxPro to develop systems of any size, so we were forced to learn Dot Net quite some time ago which is not little but the XSharp project forces us to overcome several challenges:
A. Is there anyone who has traveled the same path I am traveling and documenting the experience? B. Is it possible to shorten our learning curve with community guidance? C. How many people we are? I'm trying to acknowledge the FoxPro community, looking for a feedback. D. Is there a way to do step-by-step execution of language creation? E. How to debug Roslyn Analyzer project? I could not find within XSharpDev any project template like Analizer*vsix. F. How to debug ANTLR component? Best regards Juan |
Please Log in or Create an account to join the conversation. |
Fox developper "UNBOXING XSHARPDEV " experience 25 Apr 2022 18:20 #22303
|
Hi Juan, thank you very much for sharing! I have to admit that even with my programming experience I'm far, far away from being able to understand how the compiler works. But the work on the compiler is not done only by Robert alone, AFAIK most work on the compiler and on the macrocompiler is done by Nikos Kokkalis, a greek guy (and IMHO also a programming genius like Robert). IMHO there is a lot of work to do for Fox people not on the compiler, but on the runtime libraries.... Wolfgang P.S. It may interest you: nearly all of my new X# development is done using the Core dialect, practically a C# with Xbase syntax |
Please Log in or Create an account to join the conversation. |
Fox developper "UNBOXING XSHARPDEV " experience 25 Apr 2022 19:41 #22304
|
Wolfgang, Juan. First I would like to thank Wolfgang for stepping in. Indeed Nikos has done a LOT of the work in the compiler. The first release of X# in Januari 2016 was 100% his work, as well as almost everything in the macro compiler. Since then I have also started to work on the compiler, mostly to implement the various Xbase dialects with their "quirks" and to add new C# features to the language, by inventing a syntax, adding keywords to the lexer definition, adding a statement rule to to the parser definition and by transforming the resulting X# parse tree into a C# parse tree. But when things get really complicated I have to ask Nikos for help. For example to find an efficient way to implement parameters by reference when using the Clipper calling convention. Nikos implemented most of that. One of the things Nikos also did was replacing the generated Lexer (we used to use a Antlr generated lexer) with a handwritten lexer, which dramatically improved the performance of the lexer. We use that same lexer inside Visual Studio to find tokens and to colorize them. The VS integration contains a DLL called XSharp.VSParser that contains the lexer and parser and you can use that to parse your own source code as well. I know of at least one customer that is doing that. I have no idea to be honest how many people understand how we are building the compiler. Inside our team that's Nikos and me. What we did do is to create a GitHub action that builds the compiler source every night into a set of binaries, as well as when a pull request is merged into the main branch. I also want to give credit to the other 2 team members. Chris is mostly doing support, and almost all of the compiler tests and runtime tests are written by him. He is our QA guy. No build gets released until Chris thinks it is ready. Chris also worked on several parts of the runtime, the VOXporter, the VO compatible editors inside VS (even if he does not like VS) and more. And Fabrice has worked on many things. He did our first VS integration and is still adding features to our VS integration such as the Lightbulb tooltips. Fabrice has also written several parts of the runtime (Mostly in the RDD system), he is working in our FoxPro Exporter and he is doing R&D for our Xanthi project (Client Server XBase RDD). In other words: this is a team effort. X# would have never been a success if it was a one man project. W.r.t. analyzers: X# also supports writing analyzers and running them at compile time. There are some samples on the web that show how to do this for C#. If you want to do this for X# then you should realize that you do not need to add a reference to the Microsoft.Codeanalysis assemblies but to the XSharp.CodeAnalysis assembly that comes with our compiler. Also some of the namespace have been changed by us to avoid namespace conflicts if you would want to create a project that references both our compiler DLL and the C# compiler DLL. If you guys think it is interesting we could do one or more sessions about this (and maybe show how to create and use an analyzer). I do not think there will be a big audience for this but it might still be an interesting. Robert From the "FabToys" wifi network in the house of Fabrice. XSharp Development Team The Netherlands |
Please Log in or Create an account to join the conversation. |
Fox developper "UNBOXING XSHARPDEV " experience 26 Apr 2022 05:53 #22306
|
Hi Robert, I have only mentioned Nikos because Juan mentioned the compiler. Of course, I know also the invaluable work that Chris is doing (he has helped me a lot of times, not speaking about XIDE - my interface to X#, and the piece of software I use most of my time), and I also know the important work of Fabrice on the VS integration and on the VFP tools. Thank you to your "gang of four" for your great work on the X# project! Wolfgang |
Please Log in or Create an account to join the conversation. |
Fox developper "UNBOXING XSHARPDEV " experience 26 Apr 2022 11:26 #22307
|
Hi Robert, a Session on how to build an X# analyzer or an example project with a simple analyzers could be interesting. Especially if it also shows how to implement a simple light bulb code fix (if i recall, this is connected to analyzers in VS). The two interns, that last year created the VSCode Plugin and the X# Power Tools, will come back this summer. Creating some x# analyzers could be an interesting task and challenge for them. |
Please Log in or Create an account to join the conversation. |
Fox developper "UNBOXING XSHARPDEV " experience 26 Apr 2022 12:11 #22308
|
Volkmar, we are not running analyzers or the Roslyn code inside the editor. We have tried this but found that too slow, especially with incomplete code. We have therefore written a special parser to find the various classes, methods etc, that is much more forgiving than the compiler parser. So running an analyzer in the editor will not work (for now at least). But you can run an analyzer in the compiler and check for lots of things, such as naming conventions, check for code that uses the clipper calling convention etc. I will prepare an example on how to do this and will schedule an online session about this. Robert XSharp Development Team The Netherlands |
Please Log in or Create an account to join the conversation. |
Fox developper "UNBOXING XSHARPDEV " experience 26 Apr 2022 13:45 #22309
|
Thanks. It will be interesting to see, how this works. Related question. Will the SourceGenerators (which are something similar to Analyzers, that run at build time) also work with x#? |
Please Log in or Create an account to join the conversation. |
Fox developper "UNBOXING XSHARPDEV " experience 26 Apr 2022 15:10 #22310
|
Volkmar, Yes, they should. However Meinhard detected a problem with them that we're looking into. Robert XSharp Development Team The Netherlands |
Please Log in or Create an account to join the conversation. |