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

New Surface Syntax And Parser #324

Open
zilinc opened this issue Nov 22, 2019 · 1 comment
Open

New Surface Syntax And Parser #324

zilinc opened this issue Nov 22, 2019 · 1 comment
Assignees
Labels
TASK An umbrella ticket. Mostly used in the kanban board.

Comments

@zilinc
Copy link
Contributor

zilinc commented Nov 22, 2019

Description

For some reason, we want to rewrite our surface syntax parser, and also take this opportunity to revise our surface syntax.

@zilinc zilinc added the TASK An umbrella ticket. Mostly used in the kanban board. label Nov 22, 2019
@gteege
Copy link
Contributor

gteege commented Dec 11, 2019

Just a contribution / proposal for an improved surface syntax:
An expression with an "observed variable"
<expr> !v
is difficult to read, because the variable "banging" is at the end and v is always a valid variable from the context. Since <expr> may be arbitrary large and complex, it may be misleading when you first read <expr> and only realize afterwards that v has been made readonly. Even in the bilby fs code there are examples where <expr> has more than one line.

I propose the syntax
let !v in <expr>
instead (or additionally, to be upward compatible). Remarks:

  • the rationale is that !v can be understood as introducing a new variable which is bound to the readonly value and shadows in its scope <expr> the existing variable with the linear value.
  • the usual abbreviation using and could be applied to support several banged variables and also to mix them with normal bindings, such as in
    let a = 10 and !v and !w and b = v.m in ...
  • syntactically let !v in <expr> would be a special form of the normal let-expression and may be used wherever a let-expression is permitted (or is that a problem for the core syntax?). This would even simplify the syntax (and the parser) by removing the special cases now present for banged variables.

@zilinc zilinc moved this from Paused to In progress in Cogent development roadmap Dec 17, 2019
@zilinc zilinc moved this from In progress to Paused in Cogent development roadmap Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TASK An umbrella ticket. Mostly used in the kanban board.
Development

No branches or pull requests

3 participants