Code Monkey home page Code Monkey logo

whileydocs's People

Contributors

davepearce avatar epaul avatar mansour-j avatar matt-- avatar sh4rk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

matt-- mansour-j

whileydocs's Issues

Update Introduction to S3.3 "Names"

Currently it says

There are four functional entities which can be defined within a Whiley source file:
type declarations (§3.5.2), constant declarations (§3.5.3), function declarations (§3.5.4) and
method declarations (§3.5.5).

Remove List Append

The list append operator was removed and this should be reflected in the spec.

typo in vectorMultiply example of getting started document

Minor bug in getting started document at start of Section 2.2 Arrays, in the code:

function vectorMultiply(int[] vector, int[] scalar) -> int[]:
    int i = 0
    while i < |vector|:  // needs loop invariant
        vector[i] = vector[i] * scalar
        i = i + 1
    return vector

Scalar is defined as an array (which I assume is just a typo). I would also mention that this code does not compile even with that fixed without the loop invariant i>=0 (unless I am doing something wrong) but perhaps that is intentional (to avoid getting into that discussion so early in the document). If you are not looking yet for such trivial errors given your other work, please just ignore. :)

Really enjoying playing with this language, thanks for making it so accessible!

-Tim ([email protected])

Grammar Templates for Expressions?

Currently, the grammar used for describing Whiley statements and expressions is imprecise in certain ways. For example when describing the syntax for an if statement, the condition is defined as a generic Expr, when in fact it can only be a boolean expression.

The question is whether or not we can describe this and, if so, do we want to?

continue example is broken

From chapter 5 of the specification (eg_6.whiley), the example for continue:

function sumNonNegative(int[] xs) -> int:
    int i = 0
    int r = 0
    while i < |xs|:
        if xs[i] < 0:
            continue
        r = r + xs[i]
        i = i + 1
    return r

While this example demonstrates the continue statement, it also will cause an endless loop if the array actually contains a negative value (because the i = i + 1 is also skipped).

I'm not sure how this example could be fixed to do what the function name pretends, and still use continue.

Compile time vs. Verification time vs. Runtime

In the language specification it is not clearly mentioned that there are three phases, and how they depend on each other.

This is what I gathered (e.g. from the description of the assert and assume and fail statements):

  • Compile time is when the compiler parses and analyzes the source code, does some type checking, and emits code suitable for verification and for running.
  • Verification time is when a verifier takes the compiled code (maybe in a different representation than the one which is run) and checks that it actually does what it pretends to do.
  • Run time is when an interpreter takes the compiled code and executes it.

I first assumed those phased happen always in this order, and only verified code is actually run. But the description of fail tells me that it throws a fault at runtime, while the verifier makes sure it is not reachable. How can it then throw a fault? Same for assert (which is basically if (! condition): fail).

Does this mean verification is optional?

WLS: Split Out Code Examples

Currently, some code examples are inlined into the latex files directly. These should be split out and included in the examples/ directory, and an appropriate harness created for compiling them.

Use of TypePatterns ?

Currently, type patterns are used to describe the syntax for function and method declarations, though not lambdas. However, this does not reflect what the Whiley parser does.

LambdaConstants

There is currently no syntax for lambda constants. For example, expressions like this:

type fun is function(int)->int

function f(int x) -> (int y):
    return x+1

function create() -> fun:
    return &f

Exponents in syntax of compound statements needs clarification

In the syntax of DoWhileStmt, IfStmt, SwitchStmt and WhileStmt, there are raised cursive letters (φ, ω, l, γ) without any explanation on what they mean.

After some confusion I came to the conclusion that they indicate the indentation of the corresponding syntactic elements, but that is not mentioned anywhere (neither in the Indentation section nor in the Block section nor anywhere in the Control Statements section).

No grammar for LVals

LVals are referred to in section 5.3 "Assignment Statements", but there is no grammar defined anywhere for them.

Update Syntax for Casts

As a result of issue 427 the syntax of cast and bracketed expressions has changed somewhat. This needs to be reflected in the Specification.

Operator Precedence

There is currently a serious problem with the rules describing operator precedence. For example, they indicate that !x.f should parse as (!x).f which is definitely broken.

Thanks to @richdougherty for pointing this out.

Update Terminology from List to Array

The terminology in Whiley is set to change. The "list" type is to be replaced with the "array" type. Hence, all documents need to be updated in two ways:

  1. Should refer to array types and array expressions.
  2. Should use array type syntax, rather than old list syntax.

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.