• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ayazhafiz / hgb / 424
95%

Build:
DEFAULT BRANCH: master
Ran 29 Apr 2020 07:56PM UTC
Jobs 1
Files 7
Run time 3s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
424

push

travis-ci-com

ayazhafiz
Distinguish statements and expressions

Gingerbread is an expression-based language whose control flow is guided
by statements. Currently, we parse all Gingerbread programs as a series
of expressions (which are evaluatable to a result), but in fact we
should parse programs as a series of statements (containers for
expression evaluations) to represent this control flow.

This commit distinguishes `Expression` and `Statement` grammars, and
moves the parser module to parse programs as a list of `Statement`s
rather than `Expression`s. In this commit, statements include expression
statements, variable declarations, and function declarations.

Because a sequence of statements in a block can serve as an expression
itself, this commit introduces a new expression: `BlockExpr`. A
`BlockExpr` consists of a series of statements followed by an
optional expression; the value of the `BlockExpr` is the value of
the final expression, or the unit type if there is no final expression.
`BlockExpr`s are useful as function or conditional bodies.
Following is an example listing of the values of a `BlockExpr`:

```gb
a : int  = if true { 1  } else { 2  } => a = 1
a : void = if true { 1; } else { 2; } => a is void
```

This commit also adds some TODOs to fix up inconsistencies in the
grammar introduced by the statement/expression differentiation. Most
notably, final expressions in `BlockExpr`s are currently not parsed.

Closes #40.

435 of 452 relevant lines covered (96.24%)

0.96 hits per line

Jobs
ID Job ID Ran Files Coverage
1 424.1 29 Apr 2020 07:56PM UTC 0
96.24
Travis Job 424.1
Source Files on build 424
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #424
  • e80ebc7e on github
  • Prev Build on master (#411)
  • Next Build on master (#438)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc