Commit Graph

309 Commits

Author SHA1 Message Date
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
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
John McCall
6dfa91282d 'float' -> 'float32', 'double' -> 'float64'
Swift SVN r654
2011-08-31 19:57:52 +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
58b81c8da0 Add builtin float and double types.
Swift SVN r650
2011-08-31 18:43:22 +00:00
Chris Lattner
f03486e991 diagnose a bunch of problem cases with operators.
Swift SVN r575
2011-08-20 01:29:00 +00:00
Chris Lattner
26f66a8b24 move all the parser headers into lib/Parse since they are now all private.
I chose to just delete the -lex action in swift, since it was only useful for
about 10 minutes during bringup and probably never will be again.




Swift SVN r557
2011-08-13 22:51:04 +00:00
Chris Lattner
b8fd157450 rip out the dead "isPrecededByIdentifier" logic from the AST and Lexer.
Swift SVN r529
2011-08-12 21:36:25 +00:00
Chris Lattner
c81d4c3c17 lets use isspace here, this gives us \f for free! woo
Swift SVN r511
2011-08-12 04:53:00 +00:00
John McCall
4eb22011b6 Make the lexer just determine whether an LP is spaced or not; the
parser can consume this as appropriate.  For now it isn't, but that
will change.



Swift SVN r509
2011-08-12 02:12:48 +00:00
Chris Lattner
36f5427de3 Make the lexer disambiguate between a ( that is the start of an expression and a ( that is the start of
a call argument list.


Swift SVN r508
2011-08-12 01:46:39 +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
John McCall
944183d985 Split tok::oper out of tok::identifier. No functionality change.
The consumeToken(Tok.getKind()) is terrible, but will disappear when
most of these cases have operators stripped out.



Swift SVN r500
2011-08-11 06:17:31 +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
a64c74ec94 Replace lambda keyword with func. One annoying aspect of this that I didn't
think about will occur when/if we want to support attributes on func expression.
That should look like "func [attributes]{ ... }" but now that requires looking
beyond that attributes to know if this is a funcdecl or funcexpr.  Nothing that
more heroic lookahead can't handle.



Swift SVN r486
2011-08-03 00:28:11 +00:00
Chris Lattner
fdc2dcc7db rename lexer methods to follow the naming convention and add the ability to lookahead one token.
Swift SVN r483
2011-08-03 00:07:43 +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
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
6fbe70dd87 convert TokenKind to a scoped enum, eliminating the old c++'98 hackaround to
emulate it.


Swift SVN r442
2011-07-24 19:28:36 +00:00
Chris Lattner
7275ca527a pull in StringRef and Twine.
Swift SVN r422
2011-07-19 06:00:20 +00:00
Chris Lattner
e647b29339 stop the llvm-namespace-qualification-insanity by caving in and
adding a new swift/AST/LLVM.h file which forward declares and imports
common llvm classes, starting with SMLoc.


Swift SVN r420
2011-07-19 05:49:43 +00:00
Chris Lattner
504ee85c0e introduce a 'meth' keyword.
Swift SVN r414
2011-07-19 04:19:40 +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
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
7530ec988c Add a error to reject foo() when foo is not a function type. Previously we allowed it because these are two valid top-level values, but we now reject them because they are almost certainly a bug. This can be disabled by putting a space between them if this is useful for some reason.
Swift SVN r339
2011-03-27 02:56:47 +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
b3e5c55fbc Change the parser methods to lower case to follow naming conventions.
Swift SVN r256
2011-03-06 23:28:17 +00:00
Chris Lattner
272d9e8dad Propagate "there were errors in the input" out to the exit code of the swift app by adding a "HadError" bool to ASTContext.
Swift SVN r244
2011-03-01 07:59:53 +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
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
b9fbd77f58 Fix a bunch of minor bugs found through inspection:
1. Punctuation identifiers were missing some characters.
2. Some parser production and methods were misnamed.
3. Top level var decls don't need a ; after them.
4. Various parser comments were out of date.
5. We now allow any type in a struct decl, e.g. "struct foo int", even though it's weird.

Swift SVN r199
2010-10-12 07:24:33 +00:00
Chris Lattner
f92a3d56d7 Implement parser support for structs, improve datadecl dumping.
Swift SVN r192
2010-10-10 06:38:24 +00:00
Chris Lattner
43f2d1dfa5 wire up parser and basic sema support for scoped identifier expressions (X::Y).
Swift SVN r180
2010-10-09 23:01:17 +00:00
Chris Lattner
09a023c3cd Now that we have simple user defined data types, remove the __builtin_else_hack type. woot.
Swift SVN r179
2010-10-09 22:06:13 +00:00
Chris Lattner
17c36aa749 add parser support for simple data declarations
Swift SVN r170
2010-10-09 18:42:54 +00:00
Chris Lattner
19e5390b78 twinify more diagnostics.
Swift SVN r168
2010-10-09 17:50:40 +00:00
Chris Lattner
51b9de2931 update to build with llvm mainline (twinification of SourceMgr)
Swift SVN r167
2010-10-09 17:44:21 +00:00
Chris Lattner
1bef5bd648 Bertrand prefers $0 to _1 for anonymous closure arguments.
Swift SVN r165
2010-09-18 16:57:10 +00:00
Chris Lattner
d2abfde434 introduce a new builtin type to represent the result of the else binary operator (which is a temporary hack until we get user defined types).
Use it to define ife/else.  Fix some precedence/parsing bugs that implementing else exposed. 

Swift SVN r162
2010-08-08 22:37:56 +00:00
Chris Lattner
e1e335610f int is no longer a keyword, it is a type alias for the new __builtin_int32_type type.
Swift SVN r146
2010-08-04 05:27:45 +00:00
Chris Lattner
69133a6ed2 now that we have type aliases, eliminate void as a keyword.
Swift SVN r145
2010-08-04 05:16:37 +00:00
Chris Lattner
8f86874c19 add parser support for typealiases, we have to be able to exercise the canonical type system somehow.
Swift SVN r143
2010-08-04 04:42:13 +00:00
Chris Lattner
04f7a08621 add support for tuple field access with ".", e.g.:
var a : (int, var f : int, int);
  var b = a.field0+a.field1+a.f;

This also eliminates TupleConvertExpr.

Swift SVN r137
2010-08-03 06:55:08 +00:00
Chris Lattner
8e3881d793 Enhance the lexer to handle lazy ||/&& and add them to the prolog.
Swift SVN r129
2010-08-01 06:36:49 +00:00
Chris Lattner
47afc23bac Expand lexer to cover a broader range of punctuators for function names. Add comparison functions to standard prolog.
Swift SVN r128
2010-08-01 05:58:41 +00:00
Chris Lattner
fef3e71b42 stub out parsing of func declarations.
Swift SVN r95
2010-07-27 05:32:16 +00:00
Chris Lattner
7e0123c768 Kill off add/sub/mul/div as special AST nodes. Instead, + is just yet-another identifier token and BinaryExpr is a generalized infix call expression.
Swift SVN r88
2010-07-25 19:16:45 +00:00
Chris Lattner
94110869e0 add support for parsing attribute lists, and add the first attribute, infix=42. It is now parsed and slammed into the AST, but not used.
Swift SVN r79
2010-07-24 20:44:56 +00:00
Chris Lattner
1103ff5227 Implement basic parser support for brace expressions.
Swift SVN r69
2010-07-23 18:33:49 +00:00