GithubHelp home page GithubHelp logo

Comments (1)

MeAmAnUsername avatar MeAmAnUsername commented on July 30, 2024

func <name>(<params>)[<context_params>] -> <res_type> = <exp>

func parseIR(input: supplier<string>)[irParse: IRParse] -> IStrategoTerm = ...
func invokeStrategoStrategy(...)[runtime: StrategoRuntime, @Named projectName: String] -> IStrategoTerm = ...

Description

  • Parts of the context that the task needs access to.
    • Just compiles to Dagger Dependency injection for now
    • Different compiler could compile it to e.g. other injection framework, access of static variable, lookup in a store, etc.
  • optional; if no context parameters the [] can be omitted
    • backwards compatible with existing syntax

requirements:

Required:

  • has to work both with foreign java and in-DSL functions => should be part of signature
  • not ambiguous with existing or future syntax

Nice to have:

  • easy to distinguish regular and context parameters => not an annotation in regular parameters

Syntax

Same as parameters but with [ ] instead of ( )

Examples / Goals

When this construct is implemented, the following should compile

func compileIrToDist(ast: supplier<IStrategoTerm>)[runtime: StrategoRuntime] -> IStrategoTerm =
  runtime.invokeNoNull("compileToDist", ast.get<>());

func compileIrToPlsql(ast: supplier<IStrategoTerm>)[runtime: StrategoRuntime] -> IStrategoTerm =
  runtime.invokeNoNull("compileToPlsql", ast.get<>());

func parseCpp(input: supplier<string>) -> ParseResult =
  foreign oracle.cpp.spoofax.task.cppParse
class compileIrToDist implements TaskDef<Supplier<IStrategoTerm>, IStrategoTerm> {
  private final StrategoRuntime runtime;
  
  @Inject public compileIrToDist(StrategoRuntime runtime) {
    this.runtime = runtime;
  }

  public String id() {...}

  public IStrategoTerm exec(ExecContext execContext, Supplier<StrategoTerm> ast) {
    return runtime.invokeNoNull("compileToDist", ast.get());
  }
}

class compileIrToPlsql implements TaskDef<Supplier<IStrategoTerm>, IStrategoTerm> {
  private final StrategoRuntime runtime;
  
  @Inject public compileIrToPlsql(StrategoRuntime runtime) {
    this.runtime = runtime;
  }

  public String id() {...}

  public IStrategoTerm exec(ExecContext execContext, Supplier<StrategoTerm> ast) {
    return runtime.invokeNoNull("compileToPlsql", ast.get());
  }
}

from pie.

Related Issues (20)

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.