Rob Pike
265e73ee14
beginnings of reflection values.
...
R=rsc
DELTA=421 (357 added, 17 deleted, 47 changed)
OCL=17388
CL=17401
2008-10-17 18:06:29 -07:00
Robert Griesemer
071e963e0e
- fixed bug that wasn't caught by 6g (but by gccgo)
...
R=r
DELTA=1 (0 added, 0 deleted, 1 changed)
OCL=17380
CL=17380
2008-10-17 16:27:49 -07:00
Robert Griesemer
f39b518bcb
- fixed a couple of corner cases (empty statements, empty composites)
...
- more robust printing in presence of errors
- fixed incorrect printing of function literals
R=r
OCL=17378
CL=17378
2008-10-17 16:19:31 -07:00
Rob Pike
cac904b609
add simple synchronization mechanism.
...
R=rsc
DELTA=25 (19 added, 1 deleted, 5 changed)
OCL=17346
CL=17346
2008-10-17 10:58:34 -07:00
Robert Griesemer
61d9a3c3b0
- stronger syntax checks
...
- fixed a bug with non-eof terminated //-style comments
- collecting comments
- first experiments with reproducing comments
(works but not very pretty, disabled for now)
- idempotent for all correct .go files we have checked in
R=r
OCL=17333
CL=17333
2008-10-16 23:30:42 -07:00
Robert Griesemer
c4f9f369a6
- added test script
...
- fixed a couple of printing bugs
status: parses, reproduces, and idempotently reproduces all correct .go files
R=r
OCL=17332
CL=17332
2008-10-16 19:24:33 -07:00
Rob Pike
060f157dc8
type string parser; now handles all types
...
R=rsc
DELTA=253 (153 added, 81 deleted, 19 changed)
OCL=17331
CL=17331
2008-10-16 18:09:38 -07:00
Rob Pike
32b84d5a94
parsing of type strings. still missing: func, struct, interface, chan
...
R=rsc
DELTA=366 (337 added, 7 deleted, 22 changed)
OCL=17321
CL=17324
2008-10-16 16:38:33 -07:00
Robert Griesemer
bc641d1e9c
- more robust TokenString implementation
...
R=r
OCL=17319
CL=17319
2008-10-16 15:28:36 -07:00
Robert Griesemer
3c9b817257
snapshot:
...
- typeguards, var decls, several printing bug fixed
- now fully idempotent on many files (which are accepted by 6g afterwards)
- still some detail issues
R=r
OCL=17310
CL=17310
2008-10-16 14:25:23 -07:00
Robert Griesemer
b705ac6cf5
- composites, receivers, various add. checks
...
R=r
OCL=17295
CL=17295
2008-10-16 12:16:50 -07:00
Rob Pike
082f116b2d
Change file name from "print" to "tostring" and update the rest.
...
R=rsc
DELTA=225 (109 added, 107 deleted, 9 changed)
OCL=17294
CL=17294
2008-10-16 11:19:48 -07:00
Rob Pike
e5c114eff8
convert print to ToString.
...
file name change in next round.
R=rsc
DELTA=71 (18 added, 19 deleted, 34 changed)
OCL=17291
CL=17293
2008-10-16 11:12:02 -07:00
Robert Griesemer
a09b7fdd6c
snapshot:
...
- fallthrough stat, label decls
- improved printing layout
R=r
OCL=17283
CL=17283
2008-10-16 10:16:59 -07:00
Robert Griesemer
237eea4ea5
- updated makefile for gccgo
...
R=r
OCL=17243
CL=17245
2008-10-15 17:13:00 -07:00
Rob Pike
693a31b88e
reflection type structure. no parsing etc. yet.
...
main is a simple tester outside the Makefile.
R=rsc
DELTA=455 (455 added, 0 deleted, 0 changed)
OCL=17235
CL=17242
2008-10-15 17:11:51 -07:00
Robert Griesemer
6b49713df5
snapshot of pretty printer:
...
- almost there, receivers, labels, composites, comments are not yet printed
- runs through 18KLOC of Go code and prints it again
R=r
OCL=17237
CL=17237
2008-10-15 17:06:28 -07:00
Robert Griesemer
82fbbdfc7d
snapshot
...
- fixed expression and statement printing
- missing: declarations, comments
R=r
OCL=17207
CL=17207
2008-10-15 11:48:18 -07:00
Rob Pike
69baaa9751
move regexp to lib
...
next cl will update names and add to build
R=rsc
DELTA=1876 (938 added, 938 deleted, 0 changed)
OCL=17149
CL=17166
2008-10-14 19:22:17 -07:00
Robert Griesemer
7c3a2c47b0
- snapshot of pretty printer work
...
- accepts all Go code (use -s flag)
- complete rewrite of AST, AST building, and printing
(as a result much more compact)
- printing severely screwed up at the moment, but should be
fully working in 1 more day
R=r
DELTA=2118 (514 added, 980 deleted, 624 changed)
OCL=17161
CL=17161
2008-10-14 18:14:01 -07:00
Rob Pike
0b05e91f8b
add some tests
...
fix some bugs in () ordering and rune processing
R=rsc
DELTA=72 (27 added, 5 deleted, 40 changed)
OCL=17147
CL=17147
2008-10-14 17:45:49 -07:00
Rob Pike
75df21ceff
implement matching
...
clean up interface equality hack
still needs more tests; checking in for gccgo testing
R=rsc
DELTA=304 (261 added, 14 deleted, 29 changed)
OCL=17128
CL=17135
2008-10-14 16:32:43 -07:00
Rob Pike
e8828dcbe1
add character classes.
...
allocate into an array for easier scanning and printing.
R=rsc
DELTA=282 (193 added, 44 deleted, 45 changed)
OCL=16955
CL=16955
2008-10-11 16:48:05 -07:00
Rob Pike
0f0648d33c
convert from integer indexes to interface variables.
...
update printing.
R=rsc
DELTA=194 (60 added, 41 deleted, 93 changed)
OCL=16942
CL=16945
2008-10-10 18:42:19 -07:00
Robert Griesemer
89319cfbf9
- implemented heuristic for composite literals starting with a type name:
...
if in a if, for, or switch header, must be parenthesized
- implemented string concatenation
- simplified a lot of code
- added many more tests: can now parse all *.go files I got my hands on
- printing output currently broken in some cases, use with -s (silent) option
R=r
OCL=16932
CL=16934
2008-10-10 16:03:32 -07:00
Rob Pike
41c462c0a1
cat unmatched )
...
delete unused This() in preparation for removing linking via array indexes
R=rsc
DELTA=26 (2 added, 23 deleted, 1 changed)
OCL=16895
CL=16909
2008-10-10 12:41:43 -07:00
Rob Pike
8f5b277cac
beginnings of regular expression library.
...
will move elsewhere when more complete.
parses, does not execute.
no character classes yet.
R=rsc
DELTA=522 (522 added, 0 deleted, 0 changed)
OCL=16863
CL=16874
2008-10-09 19:40:53 -07:00
Robert Griesemer
583dac04e3
- more cleanups (simpler code for optional semi's, bug fixes)
...
R=r
OCL=16869
CL=16869
2008-10-09 18:03:16 -07:00
Robert Griesemer
638233a7d6
- don't allow empty decl lists (e.g. const ())
...
R=r
OCL=16698
CL=16698
2008-10-07 18:30:08 -07:00
Robert Griesemer
44dffd92fc
- accept new semicolon syntax (at the moment,
...
the parser accepts a bit more then it should)
R=r
OCL=16694
CL=16694
2008-10-07 17:57:19 -07:00
Russ Cox
e6cd1e445b
remove uses of *T as an implicit forward declaration of T
...
R=gri,r
OCL=16648
CL=16652
2008-10-07 12:59:54 -07:00
Russ Cox
983f06bdb6
update code to follow new semicolon rules:
...
* 1. all statements and declarations are terminated by semicolons
* 2. semicolons can be omitted at top level.
* 3. semicolons can be omitted before and after the closing ) or }
* on a list of statements or declarations.
/home/rsc/bin/addsemi and then diff+tweak.
R=r,gri
OCL=16620
CL=16643
2008-10-07 12:31:31 -07:00
Robert Griesemer
4fb6064c11
- fixed Makefile, added more tests
...
- fixed parsing of parameter lists (sigh)
R=r
DELTA=48 (22 added, 7 deleted, 19 changed)
OCL=16319
CL=16321
2008-10-01 14:31:44 -07:00
Robert Griesemer
a6400dd448
more fine-tuning of ;'s
...
R=r
OCL=16274
CL=16274
2008-09-30 19:31:27 -07:00
Robert Griesemer
6349d38ebc
- fixed semicolon handling in pretty printer
...
- some scanner cleanup
- new pretty-printed code can be compiled again (for some files)
R=r
OCL=16272
CL=16272
2008-09-30 18:50:29 -07:00
Robert Griesemer
bf855f5a94
- allow for embeded types in fields, and parameter lists w/o parameter names
...
- temporary work-around for 6g bug
R=r
OCL=16052
CL=16052
2008-09-27 17:42:18 -07:00
Robert Griesemer
3548350d3e
Snapshot.
...
Added support for function literals, composite literals.
Bug fixes.
R=r
OCL=15911
CL=15911
2008-09-25 17:20:39 -07:00
Robert Griesemer
8415280699
- more missing constructs added
...
- removed excessive ";"'s
- no ()'s around expressions where not needed
- parser.go now reproduced and parseable again
R=r
OCL=15881
CL=15881
2008-09-25 15:14:26 -07:00
Robert Griesemer
c51195386e
snapshot: more pretty printer stuff
...
R=r
OCL=15863
CL=15863
2008-09-25 11:50:34 -07:00
Robert Griesemer
2a19d7dc42
- added names to result signatures to make it compile with gccgo
...
- adjusted the makefile to explicitly compile flag.go and fmt.go for gccgo
R=r
OCL=15822
CL=15822
2008-09-24 22:01:52 -07:00
Robert Griesemer
c5a29a6dd4
- more ast buidling and printing
...
- almost complete language reproduced
R=r
OCL=15801
CL=15801
2008-09-24 15:50:28 -07:00
Robert Griesemer
83267dce11
- added initial formatting: indentation
...
- more AST nodes built and printed
R=r
OCL=15735
CL=15735
2008-09-23 18:34:17 -07:00
Robert Griesemer
09bed25621
- snapshot of pretty printer status
...
- parts of AST built and printed
- no formatting yet
R=r
OCL=15727
CL=15727
2008-09-23 16:40:12 -07:00
Robert Griesemer
b390608636
- added gccgo makefile
...
R=r
OCL=15693
CL=15695
2008-09-23 11:17:44 -07:00
Robert Griesemer
c13c03c261
- first cut at building and printing AST
...
R=r
OCL=15675
CL=15675
2008-09-22 18:26:12 -07:00
Robert Griesemer
d910e90edd
- heuristics for parsing composite literals in some cases
...
- fixed result parsing of function types
R=r
OCL=15585
CL=15585
2008-09-19 18:06:53 -07:00
Robert Griesemer
bf04eefddf
- simplified parser by better factoring
...
R=r
OCL=15539
CL=15542
2008-09-19 12:12:28 -07:00
Robert Griesemer
26adb31c30
- fix for out-of-bounds error found by rsc
...
- removed tests that may have wrong Go code from Makefile
R=r
OCL=15532
CL=15532
2008-09-19 10:56:35 -07:00
Robert Griesemer
6e08991eba
- fixed another parser bug, now correctly parse more tests
...
R=r
OCL=15518
CL=15518
2008-09-18 23:30:32 -07:00
Robert Griesemer
2b70c6add3
- fixed old test cases with wrong syntax
...
- added more test cases to Makefile
- fixed another parser issue (possibly a 6g bug - to be tracked down)
R=r
OCL=15516
CL=15516
2008-09-18 23:09:07 -07:00
Robert Griesemer
a1ee6804dd
- fixed bug which prevented parser.go from compiling
...
(typo in ptr decl lead to an unresolved forward declaration)
- fixed parser bugs
- fixed Makefile
- now successfully parses most code
Issues:
- composite literals (cannot be identified easily from syntax alone)
- new(T, ...) (cannot be identified easily from syntax alone since
new is not a keyword and thus could be a different function then
the allocation function at which point "new((x + y))" is legal,
but the inner "(x" looks like the beginning of a function type)
R=r
OCL=15515
CL=15515
2008-09-18 22:53:54 -07:00
Robert Griesemer
81d7c51837
First cut at a Go pretty printer:
...
- code scavenged from Go-in-Go front-end (will merge back)
- using "symbol-table" free parsing to build AST
- no printing yet
R=r
OCL=15504
CL=15504
2008-09-18 16:58:37 -07:00
Robert Griesemer
119324d785
- updated printing of chan types
...
R=r
OCL=15448
CL=15448
2008-09-17 14:26:01 -07:00
Robert Griesemer
a456463891
- changed my scanner/parser to accept new channel syntax
...
R=r
OCL=15439
CL=15439
2008-09-17 13:05:39 -07:00
Robert Griesemer
e1a9b6ee77
- updated code to work again with latest 6g version
...
R=r
OCL=15235
CL=15235
2008-09-12 12:09:43 -07:00
Robert Griesemer
0ba1db7475
- fixed missing return issues
...
R=r
OCL=15168
CL=15168
2008-09-11 15:38:22 -07:00
Robert Griesemer
478090851b
- adjust my code and tests to new function syntax
...
R=r
OCL=14939
CL=14941
2008-09-08 13:26:52 -07:00
Robert Griesemer
30aa83ca6e
- adjusted my submitted code to work with latest compiler changes
...
R=r
OCL=14734
CL=14734
2008-09-02 17:26:00 -07:00
Robert Griesemer
683ded80c9
- changed go-in-go parser to require ()'s for panic and print
...
- adjusted much of the existing go code
- missing: tests
R=r
DELTA=229 (1 added, 17 deleted, 211 changed)
OCL=14103
CL=14103
2008-08-11 21:20:42 -07:00
Robert Griesemer
58ba20b5a2
- allow reserved words as field and method names
...
R=r
OCL=14102
CL=14102
2008-08-11 20:40:37 -07:00
Robert Griesemer
40c93a5238
- experiments with forward-declaring types of non-imported packages
...
- adjusted switch syntax (no repeated case: case: anymore)
- enabled some constant expressions that work now
R=r
OCL=14098
CL=14098
2008-08-11 18:44:41 -07:00
Robert Griesemer
c7fb27f6e4
- more steps towards automatic recursive compilation of dependencies
...
- make forward declarations of types match 6g
- better factoring
R=r
OCL=14059
CL=14059
2008-08-11 09:45:40 -07:00
Robert Griesemer
bc13a1a374
first primitive cut at resolving missing imports automatically:
...
if an import file is missing, the corresponding source
is compiled automatically, if found
R=r
OCL=13990
CL=13990
2008-08-07 19:32:22 -07:00
Robert Griesemer
882ac63885
- implement scanner token stream via channel
...
- change test_scanner to scan using both methods
- add -pscan flag to Go front-end to choose between conventional
synchronous or parallel asynchronous scanning
R=r
OCL=13937
CL=13937
2008-08-06 18:57:37 -07:00
Robert Griesemer
333b70bee0
snapshot of today's changes - more semantic tests
...
R=r
OCL=13932
CL=13932
2008-08-06 17:26:46 -07:00
Robert Griesemer
687f387c0b
- added more semantic checks - more to come
...
- distinguish float/int literals syntactically
- fixed a tracing bug
R=r
OCL=13906
CL=13906
2008-08-05 18:52:37 -07:00
Robert Griesemer
28547615ce
- fixed another export bug
...
- more self-verification code
R=r
OCL=13894
CL=13894
2008-08-05 15:20:58 -07:00
Robert Griesemer
7a799be49a
- switch to new export syntax
...
- deprecate old syntax in this front-end (use -6g for compatibility)
R=r
OCL=13831
CL=13833
2008-08-04 15:37:47 -07:00
Robert Griesemer
997a94294f
- import/export cleanup: added comments, removed dead code, re-org structure
...
R=r
OCL=13816
CL=13816
2008-08-04 13:27:05 -07:00
Robert Griesemer
71d50b8bf9
- more import/export stuff
...
- use new export syntax
R=r
OCL=13807
CL=13807
2008-08-04 10:19:36 -07:00
Robert Griesemer
c6eb85aecf
- simplified handling of primary types (types w/ names which must
...
be canonicalized upon import)
- missed some exports
R=r
OCL=13733
CL=13733
2008-08-01 14:50:18 -07:00
Robert Griesemer
0abbb8c76b
more import/export stuff:
...
- no need to import/export predeclared types
- fix for receiver types
- cleanups
- added tests to Makefile
R=r
OCL=13728
CL=13730
2008-08-01 13:33:31 -07:00
Robert Griesemer
54c8948f7f
- added import/export test cases
...
R=r
OCL=13723
CL=13723
2008-08-01 12:14:15 -07:00
Robert Griesemer
57fcdcca21
fixed bug in FixExt routine
...
R=r
OCL=13695
CL=13695
2008-07-31 15:35:25 -07:00
Robert Griesemer
9761a6d069
- backward link from objs to containing scope
...
(first step towards cleaner package handling)
- check that map, function, and channel vars are pointers
R=r
OCL=13690
CL=13690
2008-07-31 13:35:30 -07:00
Robert Griesemer
0c374e9f89
- fixed a bug w/ exports (wrong package info)
...
- keep track of type alias (type T1 T0) so we can print the proper type name
R=r
OCL=13688
CL=13688
2008-07-31 10:47:10 -07:00
Robert Griesemer
9fb9e82fa3
- added missing file
...
R=r
OCL=13681
CL=13681
2008-07-30 21:51:25 -07:00
Robert Griesemer
6dd92ea6cb
- fixed import bug (import "...")
...
- better debugging support
- removed dead code
R=r
OCL=13680
CL=13680
2008-07-30 21:26:15 -07:00
Robert Griesemer
1f46513917
various fixes:
...
- missing return in import code
- proper propagation of flags to various components
- better error message when source position is missing
- cleanups
R=r
OCL=13676
CL=13676
2008-07-30 17:36:03 -07:00
Robert Griesemer
6acdf3edff
- addded interface pretty printer
...
R=r
OCL=13646
CL=13646
2008-07-30 13:01:28 -07:00
Robert Griesemer
4b0b7d8dfe
- import and export code, bug fixes
...
- almost back to where I was in C++, but now all in Go
R=r
OCL=13627
CL=13627
2008-07-29 19:02:49 -07:00
Robert Griesemer
fce9118610
- handling of pointer forward decls
...
- some comments added to bug cases
- added notes
R=r
OCL=13543
CL=13543
2008-07-29 12:03:06 -07:00
Robert Griesemer
5fc7919147
Experiments with "export":
...
Allow "export" keyword in front of a declaration. Semantics:
export *top-level* identifiers declared (but not the fields
of a struct type for instance).
R=r
OCL=13464
CL=13464
2008-07-25 11:27:13 -07:00
Robert Griesemer
cf4c37cac3
- more work on SimpleStat production
...
R=r
OCL=13461
CL=13461
2008-07-25 09:35:03 -07:00
Robert Griesemer
f03deb339a
- fixed several parser issues
...
R=r
OCL=13441
CL=13441
2008-07-24 17:00:58 -07:00
Robert Griesemer
fda1d16935
- parsing support for composite literals
...
R=r
OCL=13394
CL=13394
2008-07-23 16:59:06 -07:00
Robert Griesemer
b0ada5ddf7
- more work on semantic checks - not yet enabled by default
...
R=r
OCL=13391
CL=13391
2008-07-23 16:04:11 -07:00
Robert Griesemer
5a90ede8a4
- scanner returns now triple (tok, tok_pos, tok_val)
...
- initial try-out of AST data structures
- removed test_parser (not working anymore - parser needs more infrastructure)
SVN=128089
2008-07-18 17:18:29 -07:00
Robert Griesemer
e912c18c7c
- missing changes from prev. commit
...
SVN=128064
2008-07-18 14:23:04 -07:00
Robert Griesemer
dead164cc0
- made initial export work
...
- added code for importing (not tested)
- various fixes
SVN=128061
2008-07-18 14:04:21 -07:00
Robert Griesemer
c3e9c7d106
- more front-end stuff: hooking up packages, preparing for exports
...
SVN=127931
2008-07-17 18:02:10 -07:00
Robert Griesemer
85303f2715
- moved struct Compilation into globals.go, adjusted deps
...
- bail out after > 10 errors
- fixed send/recv statements
SVN=127890
2008-07-17 15:11:46 -07:00
Robert Griesemer
d88c759e87
- moved package code into globals.go, adjusted deps
...
SVN=127887
2008-07-17 14:53:13 -07:00
Robert Griesemer
0e67654f94
- changed channel operators
...
- more work on packages
SVN=127671
2008-07-16 17:00:48 -07:00
Robert Griesemer
f550cd67e0
- more infrastructure
...
SVN=127430
2008-07-15 19:59:00 -07:00
Robert Griesemer
a6f87794ff
- added more code (package, export, compilation)
...
- first cut at semantic checks (disabled)
SVN=127348
2008-07-15 15:37:14 -07:00
Robert Griesemer
0cee302802
- func reorg to reduce forward decls and improve structure
...
SVN=127229
2008-07-15 10:05:17 -07:00
Robert Griesemer
d9d5f3b3bc
- fixed issue with parsing function literals in statement lists
...
SVN=127218
2008-07-15 09:22:20 -07:00
Robert Griesemer
230230c880
- no column info in error messages for Rob
...
- fixed parsing of function literals
- added first round of scope handling
SVN=127124
2008-07-14 18:06:41 -07:00
Robert Griesemer
fbab6ae9b5
- added universe, universe initialization
...
- fixed types, added missing exports, etc.
SVN=127104
2008-07-14 16:57:42 -07:00
Robert Griesemer
5a81d1f29f
- more go code
...
SVN=126934
2008-07-11 20:15:12 -07:00
Robert Griesemer
ae905980e7
- fixed bug in parser.go
...
- added more tests
SVN=126784
2008-07-10 20:50:38 -07:00
Robert Griesemer
bb9d53e570
- added buildtime
...
SVN=126776
2008-07-10 18:46:30 -07:00
Robert Griesemer
afbf717eeb
- created new dir (gosrc) for go-based front-end
...
- adjusted makefiles
SVN=126763
2008-07-10 18:05:00 -07:00
Robert Griesemer
72772282cd
- more frontend pieces in Go
...
SVN=126744
2008-07-10 17:21:23 -07:00
Robert Griesemer
8be580e20d
- improved error handling
...
SVN=126718
2008-07-10 14:42:33 -07:00
Robert Griesemer
9ec762791e
- filed a bug against 6g (bug065.go)
...
- improved scanner.go error handling
SVN=126706
2008-07-10 13:45:02 -07:00
Robert Griesemer
e4a1fb7e94
- minor bug fix
...
SVN=126585
2008-07-09 17:08:20 -07:00
Robert Griesemer
6837c5927f
- initial better error reporting
...
SVN=126578
2008-07-09 16:23:48 -07:00
Robert Griesemer
415397e3b7
- replaced recursive parsing of binary expressions with
...
precedence-based expression parser
SVN=126556
2008-07-09 14:48:26 -07:00
Robert Griesemer
cab94922e7
- completed parser - accepts full language (modulo bugs)
...
SVN=126551
2008-07-09 14:01:17 -07:00
Robert Griesemer
1e9adf8228
- more fixes to parser
...
SVN=126511
2008-07-09 10:45:04 -07:00
Robert Griesemer
33069d39b6
- fixed scanner and parser issues to be able to parse math lib
...
SVN=126501
2008-07-09 10:16:33 -07:00
Robert Griesemer
8e4ee0045f
- more work on Go parser
...
- added tests
SVN=126439
2008-07-08 18:37:31 -07:00
Robert Griesemer
c40be3b1e7
- go parser parses itself
...
SVN=126408
2008-07-08 16:39:04 -07:00
Robert Griesemer
835cd46941
- first cut a Go parser in Go
...
SVN=126242
2008-07-07 17:27:14 -07:00
Robert Griesemer
65269ccd3d
- more work on Go scanner
...
SVN=126004
2008-07-03 18:07:03 -07:00
Robert Griesemer
ba25fe80a2
- minor update
...
SVN=125989
2008-07-03 16:51:22 -07:00
Robert Griesemer
b43ad96ed6
- filed a bug w/ constant evaluation
...
SVN=125966
2008-07-03 15:16:51 -07:00
Robert Griesemer
ed9743dc3a
- more Go scanner work
...
SVN=125831
2008-07-02 23:19:31 -07:00
Robert Griesemer
85728a2da7
- implemented first cut at Go scanner in Go
...
SVN=125785
2008-07-02 17:02:55 -07:00