* changed union of Statement to be private
* changed the union in Expression to be private
* changed union in Value to be private
* changed AST constructors to be static methods
* updates to syntax unit tests
* fix tuple equality, added test cases
* added a comment to an old function
* Update executable_semantics/interpreter/value.cpp
Co-authored-by: Geoff Romer <gromer@google.com>
* fix error in Geoffrey's edit
Co-authored-by: Geoff Romer <gromer@google.com>
* improved checking for liveness when reading and writing memory
* moving some functions to be methods of State
* finished moving functions into State
* Update executable_semantics/interpreter/interpreter.h
Co-authored-by: Geoff Romer <gromer@google.com>
* moved some comments, other minor edits
Co-authored-by: Geoff Romer <gromer@google.com>
* 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>
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.
* 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>
* improve abstraction for AssocList, fix bug in optional else
* add flag for tracing output, clean up code for output
* turned off tracing by default, updated goldens, removed two examples that use pointers, shouldn't have been there yet
* [executable semantics] class-ify Declaration
NFC (no functional change).
Proof of concept that we can simplify code by replacing unions with safer, more
regular types. Hand-rolled existentials (type-erasing CoW wrappers) are a follow-on
step that will further simplify usage.
Began adding `const` where possible, and replacing `std::string*` with
`std::string`. Most `const`s can disappear as we replace reference semantics
with value semantics, but in the meantime it's an important step in the right
direction.
Notes versus what jsiek wrote:
- This adopts Bazel for building.
- System-local versions of bison/flex are used. I found https://github.com/jmillikin/rules_bison, but those print a lot of warnings (things like -Wsign-compare IIRC) which makes builds hard to read. Plus I think the underlying bison_cc_library rule didn't work, so this would really only get a hermetic bison/flex build (helpful, but didn't seem worth more time).
- I'm adding in a .bazeliskrc to push a somewhat more standard choice of bazel versions. I noticed I was getting unstable versions by default, possible Google-specific, but seemed good to include.
- The `-lpthread` kludge.
- Turn all of the examples into golden tests.
- Including adding a golden test rule.
- Fixed various style guide issues. For example:
- Fixing function names to be CamelCase instead of snake_case (https://google.github.io/styleguide/cppguide.html#Function_Names)
- Removed exception use (https://google.github.io/styleguide/cppguide.html#Exceptions)
- File name fixes (https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/cpp_style_guide.md#file-names)
- Dropped `using` of `std` names -- I believe this is preferred (maybe we should be explicit about this in the Carbon style guide)
- Switched `enum` uses to `enum class` for ease-of-identification.
- Spent some time breaking out files to hopefully be easier to read/edit pieces, and understand relations between structs.
- Added `code requires` to `syntax.ypp` to address include issues
Possibly other things -- but the fundamental structure is, I believe, unchanged. I put in the golden tests pretty early to ensure I wasn't mutating output/results.