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

design & implement functions #1

Open
6 tasks
christianparpart opened this issue May 26, 2018 · 0 comments
Open
6 tasks

design & implement functions #1

christianparpart opened this issue May 26, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@christianparpart
Copy link
Owner

Syntax Spec Proposal

functionDecl      ::= 'def' SYMBOL '(' functionParamDecl ')' ':' TYPE '=' expr
functionParamDecl ::= TYPE SYMBOL (',' TYPE SYMBOL)*
TYPE              ::= 'int' | 'bool' | 'string'

Example functions:

def fib(int n) : int = {
  if (n < 3)
    return 1;
  else
    return fib(n - 1) + fib(n - 2);
}

def sum_up(int n) : int = {
  if (n < 2)
    return n;
  else
    return sum_up(n - 1) + n;
}

Implementation Checklist

  • AST
  • syntax
  • AST->IR transform
  • IR extensions
  • IR->TC codegen
  • VM implementation
@christianparpart christianparpart added the enhancement New feature or request label May 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant