Commit Graph

588 Commits

Author SHA1 Message Date
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
Chris Lattner
aa126e87f9 add a new SemaType module, add parser support for tuples.
Add lexer support for ->.  Expand the testcase.


Swift SVN r47
2010-07-21 07:17:43 +00:00
Chris Lattner
a3164a1a1a add void type.
Swift SVN r35
2010-07-19 04:40:47 +00:00
Chris Lattner
3e53d83874 implement support for parenthesized expressions.
Swift SVN r19
2010-07-18 22:36:34 +00:00
Chris Lattner
3cd9e46705 add numeric constant support, we can now lex exciting stuff
like this:

// Comment.

var x : int;
var x2 = 4;
var x3 = 4+5;



Swift SVN r11
2010-07-18 19:01:18 +00:00
Chris Lattner
6236deaabc implement lexer support for identifiers and our 2 keywords so far.
Swift SVN r10
2010-07-18 18:57:12 +00:00
Chris Lattner
80ba9c7e66 add some more punctuator characters and // comments.
Swift SVN r9
2010-07-18 01:44:13 +00:00
Chris Lattner
461f41edb1 start lexing trivial tokens, discard whitespace between them.
Swift SVN r8
2010-07-18 01:32:14 +00:00
Chris Lattner
db8e1301ff Start setting up the lexer object.
Swift SVN r7
2010-07-18 01:14:09 +00:00
Chris Lattner
874badb51b consolidate lexer stuff into the Parser lib.
Swift SVN r6
2010-07-18 00:50:29 +00:00