Giter Site home page Giter Site logo

dualbrain / build-your-own-.net-language-compiler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apress/build-your-own-.net-language-compiler

3.0 2.0 0.0 7.06 MB

'Build Your Own .NET Language and Compiler' with updates/improvements by Cory Smith. Based on the book/source by Edward G. Nilges circa 2004.

License: Other

Visual Basic .NET 91.25% FreeBasic 0.01% BASIC 0.01% VBA 4.38% HTML 4.34%

build-your-own-.net-language-compiler's Introduction

Build Your Own .NET Language and Compiler - Resurrected

I've looked at this project many times over the years and have been repeatedly frustrated that the code basically doesn't work. This is, I assume, an artifact that the code was originally written well before 2004 - in the very early days of VB.NET. I am also thinking (based on some of the code) that a lot of this code may have been written in notepad and there may be enough evidence to suggest that *the code may not have ever worked given some of the immediate errors I've encountered when trying to actually work through getting it resurrected.

DID IT EVER WORK?

Before even being able to get the code to compile, I encounter the following issues:

  • Option Strict is, nor to the best of my knowledge, not a complete statement. Several project files have this as the first line and it is missing the On or Off portion.
  • With the defined project settings, one is not able to set any breakpoints that can be hit because of the Enable Optimizations under Advanced Compiler Options is enabled in Debug mode; so how was this ever debugged?
  • The Solution isn't setup as a complete solution of all of the various projects; rather references are made to existing binaries (assemblies) that may or may not have been up to date versions as represented by the included source.

Once correcting the obvious issues that prevented it compiling...

  • The project is absolutely rife with null reference exceptions and can't execute in many cases due to cross-thread issues.

  • Even after fixing the cross-thread issues by launching the methods in the current thread and putting things in place (now that can actually debug) to check for null reference exceptions (as I hit them), the tokens seem to not generate as they may need to...

    print "hello world"

    The above code does seem to tokenize correctly, however when you try to execute it's not able to determine that System.String("hello world") is a string variable.

All of this is strange considering that Dan Appleman is attributed as having assisted with this; and my experience in the past is that his work is pretty rock-solid. It doesn't really state how much he was involved... so there is that.

And I'm sure there is more... just getting started on this.

LICENSE???

(TODO - expand upon "fair use" and discuss potentially why the existing license is "not enforcable")

For now, see below.

NOTE!!!!!

If you are looking for a completed "Working .NET Basic Compiler" (as the cover of the book suggests)... it doesn't exist!!!!

(TODO - discuss this point further with quotes from the book)

WARNING

This code is not to any level/state where I'd recommend exploring just yet. I do have it to the point where some of it will compile in moder versions of Visual Studio (2019/2022); but if you look at it wrong it will throw an exception. I've only spent a couple of hours on it so far and plan to continue to work on it as time progresses. The goal is to get it an actual functioning state - making the purchase of the book actually worth the read/money.

THE PLAN

I don't want to confuse anyone here... this project is, especially in it's current state, predominately the work of the original author. At this stage the effort thus far has been primarily getting the project (qbGUI) to simply compile and execute. As for the current status... there have been several hundred changes attempting to work through encountered exception after exception (as well as warning after warning). As I've already stated... the code from the original repo DOES NOT WORK! It is my hope that using the book combined with whatever notes within the project and source code that most of these can be resolved.

Additionally, the code is UGLY!!!!!. The code smell is pretty high and pretty much breaks nearly every .NET development rule that has evolved over the past 20 years. There will be a tremendous amount of effort put into this to clean up the code and bring it kicking-and-screaming forward two decades.

I'm also planning on porting the code to .NET 6!

At some point I may recreate/rename the project name as the overall goal I'd like to accomplish isn't "how to build your own .net language compiler" but, instead, work to create what was claimed to exist on the book cover... a "working .NET BASIC Compiler" as opposed to an arguably techically accurate statement of including a "working .NET Basic Compiler" where the term 'Basic' refers to the most minimal rather than the 'BASIC' language. However, the back of the book states:

Bundled with the online source code is a moder, object-oriented QuickBasic-compatible compiler that you'll work with throughout the book.

No... that doesn't exist; so let's fix that. ;-)

CURRENT LICENSE

At this stage the license is currently adhering to the original repo that this is forked from. With that said, I'm more of a fan of MIT - so any additions/changes/improvements that I (and others) add will default to MIT license where possible. I'll update this document more when I have additional time to spare as to my thoughts regarding the current license as well as expanding upon the "fair use" portion of the license. The short of it is that I don't believe the license is valid for a myriad of reasons; but that doesn't negate respecting where it came from and giving credit where credit is due.

In other words; this project exists as an educational tool. Once the knowledge is yours, how can I restrict what you do with that knowledge? So, to me, the best license is the MIT license given this key point.

Considering the code isn't functional (and maybe never was) and is absolutely incomplete (as stated, there isn't a functing .NET Compiler hiding in here); I'm not too concerned with the license beyond giving credit where credit is due. I'd love to discuss this further with the copyright holder... so if that is you; please contact me to discuss this further.

CREDIT WHERE CREDIT IS DUE

This project is based significantly on the initial work included as part of repository that accompanies Build Your Own .NET Language and Compiler by Edward G. Nilges (Apress, 2004).

build-your-own-.net-language-compiler's People

Contributors

dualbrain avatar gwens avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.