Eli Friedman
2f3ff69d41
Some tweaks to module import to get the demo flow working.
...
Swift SVN r1625
2012-04-25 07:29:31 +00:00
Eli Friedman
d228618b8d
Slightly expand the :help text.
...
Swift SVN r1624
2012-04-25 07:11:42 +00:00
Eli Friedman
b4ec884307
Add missing square bracket token to REPL brace matching.
...
Swift SVN r1623
2012-04-25 06:53:24 +00:00
Eli Friedman
e6865b3b23
Move the implementation of Char printing into swift.swift, and get rid of the old printChar. Fix a bug in IRGen I ran into while working on that.
...
Swift SVN r1620
2012-04-25 03:39:48 +00:00
Howard Hinnant
8856293d94
Two major changes here: Char has been renamed to Char8. This is a temporary hack with the intent that Char8 will soon dissappear. But I'm refactoring and didn't want to break things. A new type Char has been introduced. It behaves somewhat like a cross between a UInt32 and a pointer type. It compares like a UInt32. It has arithmetic like a pointer, with the difference_type being Int. The second major change is the introduction of StringCharRange (name donated by Doug). It is attempting to be a range over String respecting that String is stored as UTF-8. It is intended that an invariant of String is that it can only hold valid null-terminated UTF-8 (to reduce validation costs). I also modified the cpp implementation of printChar to accept UTF-32 and print it out via printf using UTF-8. Still to be done is address the FIXME's in String to transition to UTF-8. I'm hoping this can be done with the new StringCharRange and foreach. But I do not know for sure. I've run out of steam for the night (still on EDT). For those of you who have more steam for the night and are working hard towards our demo, please feel free to pick any of this up and modify it in whatever way helps the demo best, even if that means reverting it.
...
Swift SVN r1619
2012-04-25 02:36:27 +00:00
Eli Friedman
ee4d656007
Switch misc functions in swift.swift to use the new asmname attribute.
...
Swift SVN r1618
2012-04-25 02:13:09 +00:00
Doug Gregor
c70aa1ba27
Make String(0) actually print '0' rather than nothing ;)
...
Swift SVN r1612
2012-04-24 22:48:36 +00:00
Howard Hinnant
da897cb5c5
I'm not happy about this either. But print(String) is an exact match for printf(%s). printf takes UTF-8 strings and prints them out. It doesn't make sense to convert from UTF-8 to UTF-32 and then back to UTF-8 just to print. Test added to confirm that we can print a non-ASCII UTF-8 String.
...
Swift SVN r1609
2012-04-24 22:19:57 +00:00
Eli Friedman
bf1392c016
Add :dump_ast to dump the AST from the REPL.
...
Swift SVN r1605
2012-04-24 21:37:38 +00:00
Eli Friedman
c33ee06b35
Disable repl prompt coloring for now; see <rdar://problem/11312059>.
...
Swift SVN r1604
2012-04-24 21:34:40 +00:00
Eli Friedman
5177545bd0
Implement balancing in the REPL for parens and brackets in addition to braces. <rdar://problem/11306336>.
...
Swift SVN r1600
2012-04-24 20:50:56 +00:00
Eli Friedman
924ef61b7c
Fix repl prompt with '\' continuation. <rdar://problem/11296808>.
...
Swift SVN r1598
2012-04-24 20:39:32 +00:00
Ted Kremenek
b40804dd35
Make the swift REPL prompt a bit more swift. This is a bit hackish, and could be improved.
...
Swift SVN r1584
2012-04-24 05:23:33 +00:00
Chris Lattner
03f874e4f7
bring my ridiculous hack to the String(double) ctor, not just print(double). In the
...
demo, we now get:
Complex = (r=4.0, i=2.0)
instead of:
Complex = (r=4.000000e+00, i=2.000000e+00)
Swift SVN r1583
2012-04-24 04:45:25 +00:00
Eli Friedman
dd94cf5837
Add :dump_ir to the REPL. <rdar://problem/11305412>.
...
Swift SVN r1582
2012-04-24 03:36:47 +00:00
Eli Friedman
6c3a0e9a86
Fix a minor regression in the REPL prompt.
...
Swift SVN r1580
2012-04-24 02:29:29 +00:00
Eli Friedman
1d4ced4a9b
I finally figured out the magic invocation to get libedit to do history. <rdar://problem/11287187>.
...
Swift SVN r1579
2012-04-24 02:23:35 +00:00
Eli Friedman
399ec31cb7
Allow backslash to escape an end-of-line in the REPL.
...
Swift SVN r1578
2012-04-24 01:33:59 +00:00
Eli Friedman
36472404b2
Parse swift.swift upfront in the REPL. This has two benefits: one, we error immediately if swift.swift can't be found, or something is wrong with it. Two, it lets us JIT swift.swift upfront, which makes the REPL prompt feel more responsive. <rdar://problem/11305258>.
...
Swift SVN r1575
2012-04-24 00:55:19 +00:00
Eli Friedman
837fdf04fb
Always type-check immediately after a line is finished in the REPL. This isn't quite the same as how script mode works at the moment, but apparently it's way too confusing to delay type-checking errors. <rdar://problem/11296808>
...
Swift SVN r1572
2012-04-23 23:53:28 +00:00
Eli Friedman
67b4140862
Add simple interpreter escapes. Use ':' since it's reserved by the swift grammar. <rdar://problem/11296710>.
...
Swift SVN r1566
2012-04-23 22:31:04 +00:00
Chris Lattner
470b787197
everyone loves atan2.
...
Swift SVN r1560
2012-04-23 06:39:33 +00:00
Chris Lattner
b2457f4bd0
add sin/cos.
...
Swift SVN r1559
2012-04-23 06:19:00 +00:00
Chris Lattner
34b6a8065a
change the floating point printing format to be more concise. It wouldn't surprise me if this
...
wasn't perfect, but it is close enough for now. We now print 4.0 instead of 4.000000.
Swift SVN r1558
2012-04-23 02:57:10 +00:00
Eli Friedman
e98e2f4368
Make the logic for displaying the "Welcome to swift" equivalent to what libedit uses for the "swift>" prompt.
...
Swift SVN r1556
2012-04-23 02:12:19 +00:00
Chris Lattner
70028d1ab8
implement conversions from arithmetic types to Strings. Fix integer promotions to
...
be sign extend instead of zext since they are signed types.
Swift SVN r1554
2012-04-23 00:24:28 +00:00
Chris Lattner
cd8f3e257d
add some sqrt implementations, to be used by the demo.
...
Swift SVN r1553
2012-04-22 23:51:40 +00:00
Chris Lattner
1403d0a9ba
implement print(String) in swift.
...
Swift SVN r1547
2012-04-21 21:44:14 +00:00
Chris Lattner
ab0b5e8b5c
- Add integer <-> integer conversion functions for Int32 and Int64.
...
- add a top level abort() method.
- add an assert() implementation
- Add a "Char" typedef for Int32, switch printChar to use it.
- Add a method to String to extract an element out of it (currently named
getElement, to be named [] eventually)
- Implement String.replPrint in terms of string operations.
Swift SVN r1545
2012-04-21 21:36:28 +00:00
Chris Lattner
ea84f6ebd5
add a new UnsafePointerInt8 type, use it to implement String.size in swift instead of in C++.
...
Swift SVN r1544
2012-04-21 21:16:46 +00:00
Chris Lattner
c7922be1e5
on entering the repl, print a welcome message to stderr when it isatty().
...
Also, have the repl auto-indent the continuation prompt according to the # braces we're in.
Swift SVN r1542
2012-04-21 21:03:28 +00:00
Eli Friedman
a2c6150c13
Error recovery for the REPL. Seems to be working reasonably well. <rdar://problem/11269380>.
...
Swift SVN r1523
2012-04-20 01:14:39 +00:00
Eli Friedman
be602fcd05
Get rid of the implicit BraceStmt for the TranslationUnit; instead, have the TranslationUnit directly store a list of decls.
...
Swift SVN r1521
2012-04-20 00:17:13 +00:00
Eli Friedman
d6a92095f9
Make the REPL handle unbalanced braces, so multi-line function definitions work. <rdar://problem/11269371>.
...
Swift SVN r1514
2012-04-19 22:54:24 +00:00
Eli Friedman
4848072285
Add a hack which makes us run the initializers for "true" and "false" in script mode and REPL mode. <rdar://problem/11256886>
...
Swift SVN r1494
2012-04-19 19:04:28 +00:00
Eli Friedman
acc17d69aa
Initial implementation of the "print" part of the REPL.
...
Swift SVN r1484
2012-04-19 01:13:37 +00:00
Eli Friedman
dd17ba6324
A few minor bugfixes for REPL.
...
Swift SVN r1477
2012-04-18 21:49:27 +00:00
Howard Hinnant
77bcc0f9b6
Primative + operator for String
...
Swift SVN r1473
2012-04-18 17:24:26 +00:00
Chris Lattner
f136b16cb3
eliminate gratuitous lambda that crashes Xcode 4.3 clang.
...
Swift SVN r1456
2012-04-18 03:53:46 +00:00
Eli Friedman
cf10f0096e
Make the REPL allow mutually recursive functions spread across multiple lines, like we do in script mode.
...
Swift SVN r1453
2012-04-18 01:20:38 +00:00
Eli Friedman
dc213bca76
Implement basic REPL under swift -repl. Known demo-blockers: need error recovery, need better brace/paren handling, need to implement the "print" part of REPL.
...
Swift SVN r1452
2012-04-18 00:52:11 +00:00
Howard Hinnant
8528c79819
Rename types to first-letter-upper-case try #2 . The test suite is now passing for me.
...
Swift SVN r1447
2012-04-17 01:27:23 +00:00
Eli Friedman
37de44a35d
Implement changes to parsing/sema/etc so that we can implement a REPL and the main module parses the same way as a REPL.
...
Next step: implement an actual REPL.
Swift SVN r1441
2012-04-16 23:52:01 +00:00
Eli Friedman
6348a5a372
A bit of minor hacking to get print("hello") working.
...
Swift SVN r1355
2012-04-10 02:06:33 +00:00
Eli Friedman
22b7cd05f5
Some minor incremental improvements for module import. Allow explicitly importing Builtin, and implicitly import swift for any module which doesn't explicitly import Builtin or swift. Fixes <rdar://problem/11185519>.
...
Swift SVN r1323
2012-04-04 21:56:40 +00:00
Eli Friedman
15bc5df608
Rename Interpret* to immediate mode, which should be a bit more intuitive.
...
Swift SVN r1322
2012-04-04 20:47:21 +00:00