Commit Graph
496 Commits
Author SHA1 Message Date
Richard Smith 09763653b7 Add operator precedence parser. (#464) 2021-04-15 18:23:36 -07:00
Richard Smith 82d5a25caa Initial support for expression parsing. (#455) 2021-04-14 16:02:20 -07:00
Jon Meow 7a6c46dc1a Merge rationale and open question answers into proposals (#461)
In support of #426. There's still a little bit of surrounding framework that expects these decision files, but I'm trying to split out changes.

Note I'm dropping affirming/abstaining, as well as the accepted date -- I'd be happy to copy-paste decisions into comments on PRs if it'd be helpful, but I thought maybe we could drop those from the repo given they aren't asked for in on new proposals. If we change our minds, we can always look at git history too.
2021-04-14 15:23:25 -07:00
Jon Meow 6c3b50ad5e Move rationale to the proposal template (#459)
In support of #426. The decisions need to be merged into proposals, but I want to handle that separately.
2021-04-14 15:15:07 -07:00
Jon Meow d60389babd Stop generating decisions into the proposal index (#462) 2021-04-14 15:14:43 -07:00
Jon Meow f2c3f68813 Fix repo/respository (#452) 2021-04-14 14:46:51 -07:00
Jon Meow fa984743bf Update CODEOWNERS for the carbon-leads switch (#458) 2021-04-13 20:58:10 -07:00
dbf59bff6f Governance & evolution revamp (#426)
This proposal revamps Carbon's governance structure and evolution
process to try to make it significantly more efficient, friendly,
welcoming, and effective. Proposal process and RFCs are structured much
closer to a traditional code review. The review is driven by a Carbon
lead, although they may delegate some aspects and anyone in the
community is encouraged to participate. Resolving issues in order to
make a decision is handled with GitHub issues and through consensus
among a very small, focused team of leads. It also tries to encourage
explicitly showing interest and enthusiasm in Carbon proposals.

See the proposal text for all the details!

Many thanks to @KateGregory, @jonmeow, @mmdriley, and @zygoloid for
their early ideas and suggestions that ended leading to the direction of
this proposal. I also want to specifically thank them for challenging my
initial direction. 🙂

My plan is to update documentation, `CODEOWNERS`, and other
implementation details in follow-up PRs, but I'm happy to roll any of
them into this one where useful.

Landing as this was accepted by the core team, and reviewed by both a
Carbon lead and review manager so is covered in both processes.

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
2021-04-13 20:57:17 -07:00
Richard Smith e96a42bd09 Add terser matching support for parse trees. (#454) 2021-04-13 15:23:05 -07:00
josh11b 160c5d06d3 Update new_proposal script with --branch-start-point (#450)
* Allow configuration of start point.

* Use git switch --create.

* Maybe fix string type.

* Fix wrong flag.

* Add --dry_run flag.

* Not sure if this is needed.

* Dry run should be safe even with uncommitted changes.

* Remove side effects with --dry_run.

* Checkpoint progress.

* Make `dry_run` parameter optional so tests pass.

* Implement suggestions from code review.

* Checkpoint progress.

* Remove new dry_run_pr_number option.

* Rename --start_point to --branch_start_point.
2021-04-12 19:46:33 -07:00
Geoff Romer cf7c97bf28 Unify tuple types with tuples-of-types in the interpreter (#442) 2021-04-12 16:13:00 -07:00
Geoff Romer 22656c8e09 Remove unused code from ValueEqual, and make unsupported cases explicit. (#434) 2021-04-09 15:09:37 -07:00
Chandler Carruth 7a00f6e15b Add ASan config and enable it in fastbuild. (#437)
Adds all the necessary machinery to our toolchain and Bazel
configuration to support ASan. This includes ensuring sufficient debug
information is available for backtraces, etc.

As part of ASan, it enables UBSan to catch more basic undefined behavior
in C++. It also enables more complete checking in ASan for lifetime
bugs.

These configs can be enabled in any build mode with `--config=asan`.
They are also enabled by default in `-c fastbuild` where asserts are
also enabled. The goal is to have a single build mode that catches the
overwhelming majority of correctness issues.

Leak checking is part of ASan and finds leaks in `executable_semantics`
code that probably aren't interesting to fix right now. I've disabled
leak checking in the `BUILD` file for the test that showed this --
everything else passed. If more things need this disabled, the same
`BUILD` change should be easily replicated.

If you see unsymbolized backtraces, you may need to either put
`llvm-symbolizer` on your path, or point the `ASAN_SYMBOLIZER_PATH`
environment variable at it. For example, in the project root you could
do something like the following to use the downloaded toolchain's
symbolizer:
```bash export
ASAN_SYMBOLIZER_PATH=$PWD/bazel-clang-toolchain/bin/llvm-symbolizer
```
I'll try to update documentation soon with this as well.
2021-04-08 12:42:13 -07:00
Chandler Carruth eb85d3dce9 Add back synchronize events for deps. (#440)
This probably isn't exactly right, but it at least gives *some* low
latency way to update when all the dependencies have been addressed.
Right now, I think only the cron run will unblock dependent PRs.
2021-04-08 09:41:55 -07:00
Chandler Carruth b414e71182 Bazel handles python modules now. (#441)
Remove them from our test CI workflow.
2021-04-08 09:38:49 -07:00
Jon Meow 7716ac6784 Update pre-commit (#439) 2021-04-08 09:01:35 -07:00
Chandler Carruth 1aeb559a51 Cleanup and condense the toolchain configuration. (#436)
There was a lot of redundant noise in the older form. It also had
several issues that made the ordering and mixing together of different
flags much less obvious.

With this change, the user-provided flags are reliably placed in
a useful position, along with fundamental flags like the source file and
output.

All of this is largely in preparation for trying to add the first
sanitizer configurations (as well as enabling them by default).
2021-04-07 11:03:35 -07:00
Jon Meow b4593f5133 Add pip_install to the build. (#435)
Updates corresponding tool instructions.
2021-04-07 09:08:02 -07:00
Geoff Romer e324935139 Miscellaneous parser cleanup (#429)
- Give unary `-` and `not` the same precedence as in C++
- Add detail to parse error messages, and make the --trace flag also enable parser debug tracing
- Make any new shift-reduce conflicts into build errors
- Use `%precedence` rather than `%nonassoc` where possible, in order to catch more grammar bugs at build time
2021-04-06 10:09:03 -07:00
Chandler Carruth 2606046477 Switch to the dependent-issues action. (#432)
This supports tracking PR-to-issue and issue-to-issue dependencies in
addition to PR-to-PR, and this seems likely to be increasingly important
as we have decisions being made via issues.
2021-04-06 01:50:01 -07:00
Geoff Romer 80f035874d Restructure handling of paren expressions (#417)
* Move nontrivial logic out of `parser.ypp` into `FieldList`, rename it to `ParenContents`, make it a class, and add tests
* Use a `FieldInitializer` struct instead of `std::pair<std::string, Expression*>` to represent the fields of a tuple
2021-04-05 10:49:25 -07:00
Geoff RomerandDave Abrahams 98a6477233 Change Doxygen-style /// comments to // (see https://google.github.io/styleguide/cppguide.html#Comment_Style) (#330)
Co-authored-by: Dave Abrahams <dabrahams@google.com>
2021-04-05 10:11:48 -07:00
Jeremy G. Siek 3d02412f2f rename env and ct_env (#419)
* change env to types, ct_env to values in type checker, change env to values in interpreter

* fix bazeliskrc, change to use latest (#420)
2021-03-30 13:41:24 -04:00
josh11b c7b93c4477 gitignore emacs temp files (#421) 2021-03-29 11:55:29 -07:00
Jeremy G. Siek 66de1981e4 fix bazeliskrc, change to use latest (#420) 2021-03-28 12:49:00 -04:00
3fa72d2984 Experimental control-flow operator (#368)
* AST and syntax for delimited control

* stashing for later

* a little more progress

* progress on delimited continuations

* delimit, suspend, and resume implemented (draft)

* example that generates the natural numbers

* fixes

* tinkering

* changed demo to experimental

* comments and name changes

* describe delimited continuations in the README

* renamed Snapshot to Continuation, edits to comments

* Update executable_semantics/ast/statement.h

improve comment for MakeDelimitStmt

Co-authored-by: Dave Abrahams <dabrahams@google.com>

* Update executable_semantics/interpreter/interpreter.cpp

remove snake_case

Co-authored-by: Dave Abrahams <dabrahams@google.com>

* edits to comments, change name of variable

* updates to handle review edits

* trailing whitespace

* fixes to delimited continuations, added more tests, also fixed assignment to do a copy

* improvements from Geoffrey

* new test from Geoffrey, fix for empty blocks

* more suggestions from Geoffrey

* more tests for delimited continuations, renaming some of them

* renamed test files

* improve a comment

* sketch of creating continuation

* initial implementation of shift/reset style continuations

* more documentation

* fix some camel case

* implemented deep copy of continuations, added a test case for it

* fixed a bug and got the recursive test case working

* removed __delimit, polished up __continuation

* back to shallow copy for continuations

* suggestions from Geoffrey

* removed structured binding (for now)

* Update executable_semantics/ast/expression.cpp

Co-authored-by: Geoff Romer <gromer@google.com>

* responses to Geoffrey

Co-authored-by: Dave Abrahams <dabrahams@google.com>
Co-authored-by: Geoff Romer <gromer@google.com>
2021-03-26 11:22:48 -04:00
Jon Meow 6df0d51516 if/else (#285) 2021-03-24 16:02:22 -07:00
Geoff Romer 5fbad1089c Add bazel query flag to work around bug (#414)
Add Bazel query flag to work around https://github.com/bazelbuild/bazel/issues/8900
2021-03-24 12:14:34 -07:00
Richard Smith 9325b50cfe Make numeric literal parsing interface more value-oriented. (#407)
Instead of exposing a stateful Parser type, expose only the result of
its parsing action. This also makes the numeric literal code better
mirror the string literal code.
2021-03-22 15:39:44 -07:00
Richard Smith 9400c1c8ae Switch from manually tracking whether we've emitted any errors to asking the diagnostics machinery. (#406) 2021-03-22 14:01:01 -07:00
Matthew Riley cfe52b5705 Decision for #253 (#374) 2021-03-22 12:09:19 -07:00
Dave Abrahams dd4e37e761 const-ify Value*s in preparation for value semantic transformation (#409)
Making Values const allows us to separate the actual mutations (search for "*&" in this change) from places where the Value is effectively passed by-value.
2021-03-21 09:00:00 -07:00
Jeremy G. SiekandDave Abrahams 1da97fc9cf Separate alive flag from the Value class (#408)
* separate the alive flag from the Value class

* restored KillValue, added KillAddress

* added comments

* Update executable_semantics/interpreter/interpreter.cpp

Co-authored-by: Dave Abrahams <dabrahams@google.com>

* Update executable_semantics/interpreter/interpreter.cpp

Co-authored-by: Dave Abrahams <dabrahams@google.com>

* Update executable_semantics/interpreter/interpreter.cpp

Co-authored-by: Dave Abrahams <dabrahams@google.com>

* finish edits from Dave

Co-authored-by: Dave Abrahams <dabrahams@google.com>
2021-03-20 16:14:31 -04:00
Matthew Riley b8f6602857 Change Python version in CI to match the new minimum in our docs (#405)
This will help keep us honest about not using newer features.
2021-03-20 01:59:27 -07:00
Chandler Carruth bbb38a3728 Format WORKSPACE with buildifier. (#403)
This wasn't being caught by our `pre-commit` setup, I've sent the fix
here: https://github.com/jlebar/pre-commit-hooks/pull/9
2021-03-19 01:17:05 -07:00
Chandler Carruth 8f1f9b9fc2 Remove unused bits from our WORKSPACE. (#402)
Originally, I experimented with special rules for C++ builds of LLVM but
we ended up with a native build of it instead. Loading and using this
was completely unnecessary now and would have needed an update. Just
remove it.

Fixes #400
2021-03-19 01:00:26 -07:00
Chandler CarruthandJon Meow 251402ceb7 Make Python 3.6 our minimum version and fix tests. (#401)
This matches the version on Ubuntu LTS and other OSes. The only problem
I found with it in our testing is that Bazel confusingly sets the locale
to use `LANG=en_US` by default which breaks UTF-8 support. We may need
to shift this on Windows, but this seems like a reasonable first step.

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
2021-03-19 00:58:46 -07:00
Richard Smith 426c789d6e Convert parser diagnostics to use the diagnostic emitter. (#389) 2021-03-18 22:09:06 -07:00
Richard Smith 1e6c7e3963 Add sentinel Eof token at the end of the tokenized buffer. (#388)
This has two goals:

1) It allows us to simplify and remove special cases from the parser:
   when we expect a particular token next, we can just check for it
   without needing a special case for end-of-file.

2) It gives us a token to use as a position when emitting diagnostics at
   the end of the file.

Centralize all updating of `position` to `Consume` and `SkipTo`, so that we can in a single place ensure that we never go past the EOF token.
2021-03-18 21:39:10 -07:00
Richard Smith d1757d9979 Add location information to diagnostics. (#385)
Add simple mocking and testing of diagnostic emission to ensure this
works.
2021-03-18 21:05:54 -07:00
Jeremy G. Siek b2455d8dba renames ExecutionEnvironment, fixes #394 (#395) 2021-03-18 22:19:31 -04:00
Chandler CarruthandGeoffrey Romer e440b07eb3 Improve correctness of our Clang tooling infrastructure. (#392)
This restructures the `compile_flags.txt` to use the downloaded libc++ system
headers and avoid needing a virtual include directory to be built. It still
needs _some_ Bazel build to complete before working in order to have the libc++
system headers downloaded and the symlink to the Bazel tree created.

One (very) tricky part of making this work is to work around bugs in Clang's
tooling layer that incorrectly handle `..` path components after traversing
symlinks. To avoid this, we add a custom symlinks (`bazel-execroot` and
`bazel-clang-toolchain`) that hide the relevant traversal of the Bazel layout to
find build artifacts and the downloaded toolchain. These symlinks will be broken
until a build with Bazel downloads the toolchain and creates the basic output
tree structure.

It also adds a `create_compdb.py` script. Running this script improves the
tooling fidelity by taking a few steps:

1. It queries Bazel to find all the relevant files and adds them to a
   `compile_commands.json` database that allows `clangd` and other tools to
   index the entire project for improved cross-references, etc.
2. It builds all the generated files with Bazel so that they can be included
   successfully. This is very fast in my testing, taking only 10s of seconds. It
   is also very likely to be cached effectively.
3. It translates the arguments from `compile_flags.txt` to make them
   persistently use the built generated files include paths so that nothing
   breaks even as different targets are built potentially with different
   configurations.

There are still some limitations.

- It still requires running Bazel before anything works, even if a fast run.
- It will require re-running if new generated files are added and needed but not
  built.
- It assumes that the standard Bazel symlink names are used and available.

Much of the Python here was written by @geoffromer in #384 -- I've adapted it
here after discussing to try to fill in some of the blanks and use a slightly
different approach to querying Bazel. I use the normal `bazel query` rather than
`bazel aquery`. This, for example, allows the index to reliably cover header
files in header-only libraries more directly (rather than relying on transitive
inclusion). It also seems a bit simpler too parse, but that is a pretty minor
difference.

Co-authored-by: Geoffrey Romer <gromer@google.com>
2021-03-18 02:29:49 -07:00
Dave Abrahams 7e1721dc01 lowerCamelCase => snake_case (#396) 2021-03-17 13:09:58 -07:00
Dave Abrahams 71a8d072b4 Remove unused bazel rule (#376) 2021-03-17 10:51:16 -07:00
Dave Abrahams c4252d1c6d Remove obsolete TODO (#375) 2021-03-17 10:27:33 -07:00
Dave Abrahams 5ca6e21e11 Remove an unused function (#380) 2021-03-17 09:58:34 -07:00
Richard Smith ae9ca945b9 Rename {String,Numeric}LiteralToken -> Lexed{String,Numeric}Literal. (#373)
This avoids using a name too similar to Token::StringLiteral (the token
kind) and TokenizedBuffer::Token (which is not related to these
classes).
2021-03-16 12:42:52 -07:00
Jeremy G. SiekandJon Meow 7c4fcd3fa5 turn off tracing by default, change golden (#381)
* turn off tracing by default, change golden

* Update executable_semantics/main.cpp

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>

* Update executable_semantics/main.cpp

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>

* merge with trunk, update goldens

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
2021-03-16 09:03:10 -04:00
Jeremy G. Siek ced98ef021 Global variables (#378)
* global variables

* implemented type checking of global variable, added test case

* added a comment

* improvements based on Dave's suggestions

* improvements based on Jon's suggestions

* added test cases about global variable ordering
2021-03-15 16:06:27 -04:00
Jon Meow 41786eae25 Decision for Comments #198 (#275) 2021-03-15 09:53:15 -07:00