Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give up Razor and Skeleton for Code Generation #1028

Closed
10 tasks done
mayanje opened this issue Jul 5, 2018 · 6 comments
Closed
10 tasks done

Give up Razor and Skeleton for Code Generation #1028

mayanje opened this issue Jul 5, 2018 · 6 comments

Comments

@mayanje
Copy link
Contributor

mayanje commented Jul 5, 2018

According to issue #991 it came that with current translation templates based on Razor scripts, we fail to generate an exact code for situations like thoses described in #991.
So we need to write C# code for handling function declaration code generation.

Sub-tasks:

...To complete

@mayanje mayanje added this to the V1.2.1 milestone Jul 5, 2018
@mayanje mayanje self-assigned this Jul 5, 2018
@smedilol smedilol modified the milestones: V1.2.1, v1.2.2 Jul 9, 2018
@smedilol smedilol mentioned this issue Jul 10, 2018
mayanje added a commit that referenced this issue Jul 31, 2018
@collarbe collarbe modified the milestones: v1.2.2, v1.2.3 Aug 1, 2018
mayanje added a commit that referenced this issue Aug 3, 2018
@smedilol smedilol changed the title Give up Razor and Skeleton for Function Declaration Code Generation. Give up Razor and Skeleton for Code Generation. Aug 21, 2018
@smedilol
Copy link
Contributor

Just to be sure, we can give up Razor for all the generation process.
Even type, :: can be done in C#.

@smedilol smedilol changed the title Give up Razor and Skeleton for Code Generation. Give up Razor and Skeleton for Code Generation Aug 24, 2018
@smedilol
Copy link
Contributor

Here's what we need for our codegen:
Create new generator easily:

  • TypeCobol to Cobol85 - where Cobol85 is a general code
  • TypeCobol to Cobol85 + EI - with parts specific to our company
  • TypeCobol to Cobol85 + EI v2 - Version 2 - with parts specific to our company
  • TypeCobol to Cobol2002 - when we'll have a Compiler that support Typedef
  • ...

Each generator is assembled with different sub-generators for each concepts of TypeCobol:

  • Typedef and type
    • Typedef to Cobol85
    • Typedef strict to Typedef weak or strong (if we target a Cobol 2002 compiler)
    • Keep typedef strict, if in the future we have a compiler that support Typedef strict
  • type bool and set to false
    • Cobol2002 support set to false so in the future we could choose to generate thing differently
  • unsafe
  • operator ::
  • index qualification
  • Set up by/down by with pointer
  • procedure and call to procedure
    • For this one, we'll have at least 3 versions:
      • TypeCobol to Cobol85 - where Cobol85 is a general code
      • TypeCobol to Cobol85 + EI - with parts specific to our company
      • TypeCobol to Cobol85 + EI v2 - Version 2 - with parts specific to our company
    • We could also need a very basic template support (to be discussed)
  • namespace, using
  • future TypeCobol features...

For each concepts listed here, we could choose to do nothing during codegen because the target compiler support the feature.

@mayanje
Copy link
Contributor Author

mayanje commented Aug 29, 2018

:: Is handled by a C# code and not by Razor, even if there is an action called Qualifier, this action is first called before any Razor or Skeleton action.

@mayanje
Copy link
Contributor Author

mayanje commented Aug 29, 2018

For the requirements (Needs), yes the new Codegen must effectively support various generation scheme, so it must be flexible and customizable, and Node directed.
For the notion of basic template support, I think we must start thinking about tree pattern matching towards a rewriting system.

@mayanje
Copy link
Contributor Author

mayanje commented Aug 29, 2018

Another Idea for code generation customization, is to be driven by the parser, that is to say to use the same Cup parser used to create the AST, but now to perform CodeGen action on specific nodes, while still being Node directed.

@mayanje
Copy link
Contributor Author

mayanje commented Aug 29, 2018

Ok this is another Idea: It seems to be in contradiction, but why give up razor and skeleton? Why not create our skeleton C# code generator tool. The tool will take our current Skeleton.xml file and generates a Skeleton.cs file to be compiled. The Skeleton.cs file will not call razor or use razor , but it will contains substituted code for all razor pattern as C# code for condition's type node.

I like this idea.

So it will be possible to generate various Skeleton.cs file depending on options or output format.
And our current generation scheme is preserved.

BUT OF COURSE WE GIVE UP RAZOR, but we keep its pattern syntax.

mayanje added a commit that referenced this issue Aug 31, 2018
…n interpret Razor Language, using a Custom C# parser on expressions and statements.

We can validate pattern based on Razor Syntax using System.Web.Razor.RazorParser against C# and HtmlMarkup code parser.
Using Razor parser we can imagine to apply a Benoit Sarter idea to use TypeCobolParser syntax inside razor pattern #1028.
@mayanje mayanje mentioned this issue Nov 5, 2018
mayanje added a commit that referenced this issue Nov 6, 2018
@mayanje mayanje closed this as completed Jan 9, 2019
@maxime645 maxime645 mentioned this issue May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants