qwertie / ecsharp

Home of LoycCore, the LES language of Loyc trees, the Enhanced C# parser, the LeMP macro preprocessor, and the LLLPG parser generator.
http://ecsharp.net
Other
172 stars 25 forks source link

Can't get a simple test case to work #32

Closed hypeartist closed 8 years ago

hypeartist commented 8 years ago

Just found the drop about ECS in Roslyn issue thread and decided to give it a try. I've installed LoycSyntaxForVs and run LLLPG, created a simple console app, added a .ecs file with the following content (taken from ecsharp/Doc/EC#.cs):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication8
{
    class Alice_Bob 
    {
        public new(public int Alice, public int Bob) { }
    }
}

Then I've assigned a custom tool for .ecs file to LeMP and tried to build the solution. It failed with this:

1>------ Rebuild All started: Project: ConsoleApplication8, Configuration: Debug Any CPU ------ 1>d:\AllThatJazz\VS\Projects\ConsoleApplication8\ConsoleApplication8\Test.ecs(11,13,11,14): error CS1519: Invalid token '(' in class, struct, or interface member declaration 1>d:\AllThatJazz\VS\Projects\ConsoleApplication8\ConsoleApplication8\Test.ecs(11,32,11,38): error CS1001: Identifier expected 1>d:\AllThatJazz\VS\Projects\ConsoleApplication8\ConsoleApplication8\Test.ecs(11,32,11,38): error CS1002: ; expected 1>d:\AllThatJazz\VS\Projects\ConsoleApplication8\ConsoleApplication8\Test.ecs(11,46,11,47): error CS1003: Syntax error, ',' expected 1>d:\AllThatJazz\VS\Projects\ConsoleApplication8\ConsoleApplication8\Test.ecs(11,50,11,51): error CS1002: ; expected 1>d:\AllThatJazz\VS\Projects\ConsoleApplication8\ConsoleApplication8\Test.ecs(13,1,13,2): error CS1022: Type or namespace definition, or end-of-file expected ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

And:

Warning The custom tool 'LeMP' failed. MissingMethodException: Method not found: 'Void Loyc.Ecs.EcsNodePrinter.PrintPlainCSharp(Loyc.Syntax.LNode, System.Text.StringBuilder, Loyc.IMessageSink, System.Object, System.String, System.String)'. at Loyc.VisualStudio.LeMP.Generate(String inputFilePath, String inputFileContents, String defaultNamespace, IVsGeneratorProgress progressCallback) at Loyc.CustomToolBase.Generate(String inputFilePath, String inputFileContents, String defaultNamespace, IntPtr[] outputFileContents, UInt32& outputSize, IVsGeneratorProgress progressCallback) ConsoleApplication8 d:\AllThatJazz\VS\Projects\ConsoleApplication8\ConsoleApplication8\Test.ecs

qwertie commented 8 years ago

That's odd, MissingMethodException is a sure sign of a version mismatch between LoycSyntaxForVs and LoycFileGeneratorForVs (as I can't figure out how to prevent the latter from loading incompatible assemblies from the former), but it works on my machine. Will try to figure out the problem ASAP.

Please don't use code from EC#.cs since that contains old design sketches. In this case, the constructor notation was changed from new(...) to this(...).

The error messages are coming from the C# compiler rather than EC#, Make sure the Build action is None in the Properties of the ecs file.

qwertie commented 8 years ago

Note: as a workaround, disable the LoycSyntaxForVs extension (in Tools | Extensions and Updates) and restart VS. P.S. thanks for trying EC# and notifying me about your problem!

hypeartist commented 8 years ago

Will try to figure out the problem ASAP.

Thanks. Waiting for any tips.

Please don't use code from EC#.cs since that contains old design sketches. In this case, the constructor notation was changed from new(...) to this(...).

Is there any uptodate ECS specs with code examples (!!!). The only one seems to be at this, but it covers only some of features (no templates, no algebraic data types, no lots!!! at least according to ecsharp/Doc/EC#.cs and ecsharp/Doc/EC#2.cs))

As for LoycSyntaxForVs what kind of productivity gain it supposed to bring? Seems like it just colorizes a very few keywords and nothing more. Without formatting (even simplest pasting doesn't respect existing one) it's a real pain to code.

Anyway it's a great project and I will definitely watch for its progress.

PS: and yes, I guess the Roslyn is the very right direction! :)

qwertie commented 8 years ago

I hate to disappoint, but EC# 1.0 was never implemented :open_mouth: so the "templates" feature doesn't exist. There is an article about EC#'s Pattern Matching and Algebraic Data Types (implemented as a lexical macro) and more articles linked from the LeMP home page.

qwertie commented 8 years ago

And I'm afraid LoycSyntaxForVs is just a colorizer, and LeMP is just a front-end - all those nice features you normally get in Visual Studio aren't there. I'm trying to figure out what the quickest way is to enable the most important IDE features, but I don't know the answer (I have little experience writing VS extensions.)

qwertie commented 8 years ago

I didn't find any problems, but I double-checked that the binaries on my machine work, then I "released" them. So, please try out the release zip file found here; be sure to uninstall LoycSyntaxForVs in VS, then re-register with LoycFileGeneratorForVs.exe and re-install LoycSyntaxForVs.vsix.