Commit Graph

354 Commits

Author SHA1 Message Date
Chris Lattner
9e6817b3cd implement lexer, parser, and dox support for while loops, everything is hooked up now.
Swift SVN r502
2011-08-11 20:47:33 +00:00
Chris Lattner
ce6f6a83cd add AST support for WhileStmt. This isn't important, but is easy to add.
Swift SVN r501
2011-08-11 20:33:34 +00:00
Chris Lattner
3e8e0a0bf5 Fix the examples for oneof's with elements that have an associated type,
the grammar and parser already require a :, but the examples never got
updated.


Swift SVN r498
2011-08-10 05:00:52 +00:00
Chris Lattner
39660b5017 add langref and lexer support for return stmt.
Swift SVN r492
2011-08-03 22:43:57 +00:00
Chris Lattner
b7049da44c clean up the grammar by introducing an explicit 'decl' production.
It turns out we already allow nested functions, how about that.



Swift SVN r490
2011-08-03 22:31:01 +00:00
Chris Lattner
c86e786ab5 switch langref to new func syntax, switch implementation to use FuncExpr instead of LambdaExpr.
Swift SVN r487
2011-08-03 00:32:15 +00:00
Chris Lattner
ea9cd782d8 lambda expressions now require a type that start with a tuple, such as (x : int).
John can fix func decls.


Swift SVN r485
2011-08-03 00:18:12 +00:00
Chris Lattner
0265e3cbd1 make 'else if' a special case, disallowing things like "else ;".
Swift SVN r482
2011-08-02 21:31:31 +00:00
Chris Lattner
dc56b324a8 linkify some grammar references, add testcase, remove entry from readme.
Swift SVN r479
2011-08-01 17:47:36 +00:00
Chris Lattner
350b89e6e4 Represent assignments as their own AssignStmt, preserving the model we had
before, but removing the hack where we'd represent them as a binary operator
with a null operator function.  We still have no clear semantics for what 
is valid or not.



Swift SVN r478
2011-08-01 17:45:21 +00:00
Chris Lattner
ebc33d306f add AST support for semicolon statements and clean up the parser. While noone cares, it is trivial
to support and good for completeness.


Swift SVN r475
2011-07-31 21:09:23 +00:00
Chris Lattner
c3bbefcbaa add support for lambda expressions (anonymous functions), which are the thing that
func is sugar for.  Unfortunately, we can't use 'func' without introducing ambiguity
since decls and exprs can exist in the same context, I'm not wed to 'lambda' as the
keyword, thoughts welcome.


Swift SVN r467
2011-07-31 20:12:20 +00:00
Chris Lattner
d232974df1 introduce a new FuncExpr AST node. No clients yet though.
Swift SVN r465
2011-07-31 18:10:24 +00:00
Chris Lattner
63ce0be641 make the big switch: {} are now statements, not expressions. This removes some
annoying things from the grammar (like expr-non-brace), and makes it so that 
the body/else of an if is just a statement.

This patch has a fairly serious caveat that we just drop function bodies on the
floor now, since we have no "stmtexpr" sort of thing to represent the syntactic
sugar that is func.  We'll fix that soon.


Swift SVN r462
2011-07-31 17:39:13 +00:00
Chris Lattner
382f33ec74 introduce statements, make if (and ;) a statement. This includes a
few horrible hacks, but is the right direction to go.


Swift SVN r457
2011-07-31 06:52:11 +00:00
Chris Lattner
0e95d1ba29 start carving out a place for statements, this is obviously in progress, I made the mistake of upgrading Xcode and now it doesn't launch...
Swift SVN r455
2011-07-29 23:16:47 +00:00
Chris Lattner
0fc77abf5c Per discussion on swift-dev, unify 'meth' and 'func' syntax into just 'func' syntax
where you can optionally declare a receiver type.  This is cleaner both conceptually
and in implementation, and eliminates drug references. :)


Swift SVN r444
2011-07-24 20:11:35 +00:00
Chris Lattner
4dc572ddd7 per discussion on swift dev, remove the "=" syntax for defining a body of a function.
Swift SVN r435
2011-07-24 00:29:22 +00:00
Chris Lattner
ba2793aa6b implement parser support for methods, including dox and
a testcase.  No AST or sema yet.


Swift SVN r415
2011-07-19 04:46:07 +00:00
Chris Lattner
504ee85c0e introduce a 'meth' keyword.
Swift SVN r414
2011-07-19 04:19:40 +00:00
Chris Lattner
ed09f95ec7 notes from doug's feedback
Swift SVN r413
2011-07-19 03:49:54 +00:00
Doug Gregor
023c9cc431 Fix a typo
Swift SVN r402
2011-07-13 18:17:18 +00:00
Chris Lattner
b9e7823656 Implement lexing and parsing support for a proper if expression. There
is no AST building or typechecking support yet.  Document the intended
semantics in LangRef.  This is clearly subject to change, but is a starting
point.


Swift SVN r393
2011-06-05 02:03:48 +00:00
Chris Lattner
724b49515d Fix int to not be a typealias for __builtin_int64_type - it is
a struct containing one now.  This allows different operators
to be defined (some day) for uint and int, even though both are
i32's.


Swift SVN r391
2011-05-31 03:55:58 +00:00
Chris Lattner
de094d7cde Introduce i1/i8/i16/i64 types, and switch int to be 64-bit.
Swift SVN r390
2011-05-31 03:48:36 +00:00
Chris Lattner
d3d1278c7e John points out that struct foo { ... } is more consistent with oneof and generally makes more sense than struct foo (...). Switch!
Swift SVN r372
2011-04-22 06:12:21 +00:00
Chris Lattner
8c833bc36d More writing.
Swift SVN r360
2011-04-10 23:55:52 +00:00
Chris Lattner
c45c9295cf Describe expressions.
Swift SVN r359
2011-04-10 23:36:11 +00:00
Chris Lattner
0d54f3e6f6 Major cleanups to decls and types section of langref.html. Expressions needs to be largely rewritten.
Swift SVN r358
2011-04-10 17:43:26 +00:00
Chris Lattner
eb9d1353d2 Allow name binding to bind to struct elements.
Swift SVN r332
2011-03-23 06:36:01 +00:00
Chris Lattner
c9ee19e269 Implement parser, sema, doc, and name lookup support for refined import declarations. You can still only do top level references, but that's because we don't have namespaces or anything else interesting yet.
This allows "import swift.int" for example. 

Swift SVN r329
2011-03-23 05:18:29 +00:00
Chris Lattner
2205513c45 Add a comment acknowledging that conversions are ambiguous and give an example. Simplify some code.
Swift SVN r328
2011-03-23 04:50:15 +00:00
Chris Lattner
c9eb885752 Introduce top-level expressions and simplify TranslationUnitDecl (and various things that hack on it) by making it hold a single BraceExpr instead of a list of exprs and decls.
Swift SVN r293
2011-03-20 06:59:37 +00:00
Chris Lattner
d23c2f26f3 Document and implement lexer and parser support for trivial import decls. No Sema/AST support yet.
Swift SVN r285
2011-03-18 22:52:48 +00:00
Chris Lattner
cabbe439ed Update to describe handling of integer_literal_type.
Swift SVN r284
2011-03-18 21:02:54 +00:00
Chris Lattner
bd4ccf1a55 Fix structs to require that their element type be a syntactic tuple. Rejecting the testcase.
Swift SVN r251
2011-03-02 07:11:34 +00:00
Chris Lattner
80e1ae6104 Rework a bunch of stuff in the type system: now the *only* way to name a type is through a 'typealias' and there is no such thing as a OneOfDecl. Instead, we have OneOfType's, which are always anonymous. "oneof declarations" and "struct declarations" are now both just sugar.
This eliminates the NamedTypeDecl class (because there is now only one named type decl), eliminates OneOfDecl, renames AliasTypeDecl to NameAliasTypeDecl for good measure, and introduces OneOfType.

This preserves all existing syntax, and allows stuff like this:

func test6(checkboxenabled : oneof { Yep, Nope }) {
  test6(:Yep)
}

Which is an anonymous oneof.

Swift SVN r237
2011-02-26 02:03:01 +00:00
Chris Lattner
7bbe52b52a Expand the swift language to allow typealiases, oneof, and struct within a brace expression. This allows us to have shadowing of type names.
Swift SVN r236
2011-02-22 07:41:44 +00:00
Chris Lattner
2cc0b81d20 Introduce bool into the standard library, updating comparisons and short circuit operators. Expand the documentation for standard types and the operators. Fix the precedence of the comparison operators to be correct.
Swift SVN r224
2010-11-29 06:54:29 +00:00
Chris Lattner
8234b6fd66 Add some sema for tuple elements which are specified with a default value. Still not used for conversions yet.
Swift SVN r219
2010-11-25 21:18:48 +00:00
Chris Lattner
bc616e9fcd Split the initializer syntax from var decls out to their own 'value-specifier' production
Swift SVN r217
2010-11-25 17:00:34 +00:00
Chris Lattner
28789d43d2 Resolve a fixme: use foo.$1 instead of foo.field1
Swift SVN r216
2010-11-11 23:04:29 +00:00
Chris Lattner
3bd8a85784 Fix weirdness in the lang spec by making $123 be a special type of implementation identifier token, handling it uniformly in the grammar in the few places that it is valid.
Swift SVN r215
2010-11-11 22:27:39 +00:00
Chris Lattner
2653092ae5 Change the grammar for oneof elements to require a ':' make them more swift like and less ml like. Before we had:
oneof MaybeInt {
  None,
  Some int
}

Now we have:

oneof MaybeInt {
  None,
  Some : int
}

This resolves a fixme in the langref.

Swift SVN r214
2010-11-11 21:06:00 +00:00
Chris Lattner
70bb5880bc Various updates thanks to comments from DaveZ, add a right hand sidebar with commentary.
Move the .js file internally so we're not dependent on the go server.

Swift SVN r213
2010-11-11 05:20:00 +00:00
Chris Lattner
906ba908fd Rename 'data' to 'oneof', resolving a fixme in the spec. Yay for CLU!
Swift SVN r212
2010-11-11 01:20:36 +00:00
Chris Lattner
3892ef2e1d add some FIXMEs for comments from bertrand
Swift SVN r211
2010-10-24 16:46:39 +00:00
Chris Lattner
2f0d96885a Move field exprs to their own section in langref. Document subscript exprs. Still no sema support.
Swift SVN r210
2010-10-18 06:34:46 +00:00
Chris Lattner
f66d7a6faf Update langref for array types.
Swift SVN r208
2010-10-17 13:57:10 +00:00
Chris Lattner
fd54c7f5a0 add parser support for array types, no sema or ast yet.
Swift SVN r205
2010-10-15 11:54:34 +00:00