Commit Graph

276 Commits

Author SHA1 Message Date
John McCall
f121bd5e2d Arbitrary-associativity operator precedence parsing.
Swift SVN r743
2011-09-29 01:31:16 +00:00
Chris Lattner
9d240a1d18 add lexer and langref support for floating point literals. No AST/CodeGen support yet.
Swift SVN r706
2011-09-15 21:29:12 +00:00
Chris Lattner
4a5c409408 Change the stdlib so that int is just a typealias for int64, not its own unique type.
Update langref to describe the builtin module as an implementation detail of the stdlib,
expand the stdlib a bit.



Swift SVN r703
2011-09-09 05:39:57 +00:00
John McCall
1e89b0e274 Remove the __builtin type keywords and make the Builtin
module export those types.

Also, document the language changes I've been making in this area.



Swift SVN r688
2011-09-04 07:34:01 +00:00
Chris Lattner
34ec8bc4aa implement support for var members of protocols.
Swift SVN r672
2011-09-01 21:57:35 +00:00
Chris Lattner
c7fd9ec3bc remove the old grammar production for func's in protocols and just use
decl-func instead.  Hey look, now we have support for default 
implementations.


Swift SVN r671
2011-09-01 21:34:04 +00:00
Chris Lattner
5d78286e3f split the "func a::b()" form out to its own grammar production.
Swift SVN r669
2011-09-01 18:21:27 +00:00
Chris Lattner
fa34062b2d refactor the attribute grammar so that attribute-list is nullable,
simplifying LangRef and the parser.


Swift SVN r667
2011-09-01 18:06:46 +00:00
Chris Lattner
e7e0c657c0 checkpoint, nothing interesting to see here.
Swift SVN r665
2011-08-31 23:54:57 +00:00
Dave Zarzycki
ff9fda80ab Document floating-point intrinsics
Swift SVN r659
2011-08-31 22:08:29 +00:00
Chris Lattner
7d89538c35 elements of a protocol aren't comma separated.
Swift SVN r658
2011-08-31 21:45:01 +00:00
Chris Lattner
d77e4ad649 implement support for protocol decls.
Swift SVN r655
2011-08-31 19:58:47 +00:00
Chris Lattner
f9b024adb0 implement parser and AST support for trivial (empty) protocol types.
Swift SVN r652
2011-08-31 19:43:06 +00:00
John McCall
6daf126d7a Remove spurious colons from tuple type elements.
Swift SVN r649
2011-08-31 03:11:50 +00:00
Chris Lattner
fd4aefa837 rename the infix attribute to infix_left.
Swift SVN r647
2011-08-31 00:32:15 +00:00
Chris Lattner
af4d36f463 Eliminate the 'unary' attribute, instead just know that operators
that take a single argument are unary.  Move a bunch of semantic
checking of operators from the parser to TypeCheckDecl now that it
has a decent place to hold it.


Swift SVN r646
2011-08-31 00:13:57 +00:00
Chris Lattner
28f05f0348 add parser and sema support for user defined unary operators.
Swift SVN r572
2011-08-20 00:27:11 +00:00
Chris Lattner
41a924e723 synch up the grammar in the parser and langref, and make the
expression section of langref make more sense.



Swift SVN r571
2011-08-19 23:10:13 +00:00
John McCall
7de102df78 Revise LangRef per Chris's review.
Swift SVN r522
2011-08-12 17:19:59 +00:00
Chris Lattner
432a738b60 fix broken link
Swift SVN r521
2011-08-12 16:30:50 +00:00
John McCall
ff767b7b46 Update the language reference for the operator and juxtaposition
changes.



Swift SVN r520
2011-08-12 07:51:23 +00:00
Chris Lattner
0871b128f8 add support for /**/ comments to the lexer, allow nesting of them since we won't
have the #if 0 hack to handle nesting.


Swift SVN r506
2011-08-12 00:37:01 +00:00
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