Skip to content

Commit d45fa42

Browse files
committed
various fixes to get esc to parse its parser; start at refactoring the back end
--HG-- branch : com.mozilla.es4.smlnj extra : convert_revision : 5a7376fe326ddc38dfedc3ee8101c1a20bb19d7b
1 parent 8fadb97 commit d45fa42

20 files changed

+2204
-70
lines changed

comp-esc.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44

55
### DECODE
66

7-
./esc1.sh tests/self/debug.es
8-
./esc1.sh tests/self/ast.es
9-
./esc1.sh tests/self/decoder.es
10-
./esc1.sh tests/self/encoder.es
11-
./esc1.sh tests/self/esc2.es
7+
#./esc1.sh tests/self/debug.es
8+
#./esc1.sh tests/self/ast.es
9+
#./esc1.sh tests/self/decoder.es
10+
#./esc1.sh tests/self/encoder.es
11+
#./esc1.sh tests/self/esc2.es
1212

1313
### PARSE
1414

15-
./esc1.sh tests/self/lex-char.es
16-
./esc1.sh tests/self/lex-token.es
17-
./esc1.sh tests/self/lex-scan.es
15+
#./esc1.sh tests/self/lex-char.es
16+
#./esc1.sh tests/self/lex-token.es
17+
#./esc1.sh tests/self/lex-scan.es
1818
#./esc1.sh tests/self/parse-util.es
1919
#./esc1.sh tests/self/parse-ident.es
2020
#./esc1.sh tests/self/parse-expr.es
2121
#./esc1.sh tests/self/parse-ptrn.es
2222
#./esc1.sh tests/self/parse-type.es
2323
#./esc1.sh tests/self/parse-stmt.es
24-
#./esc1.sh tests/self/parse-prgm.es
25-
#./esc1.sh tests/self/esc1.es
24+
./esc1.sh tests/self/parse-prgm.es
25+
./esc1.sh tests/self/esc1.es
2626

2727
### GENERATE
2828

@@ -48,7 +48,9 @@
4848

4949
### PARSE
5050

51-
#./esc2.sh tests/self/lexer.es
51+
#./esc2.sh tests/self/lex-char.es
52+
#./esc2.sh tests/self/lex-token.es
53+
#./esc2.sh tests/self/lex-scan.es
5254
#./esc2.sh tests/self/parser-util.es
5355
#./esc2.sh tests/self/parser-identexpr.es
5456
#./esc2.sh tests/self/parser-expr.es

esc-env.ast

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,48 @@ var ast =
5050
, { 'ast_class': 'NamespaceFixture'
5151
, 'ns': { 'ast_class': 'AnonymousNamespace'
5252
, 'name': 'Parse' } } ]
53+
, [ { 'ast_class': 'PropName'
54+
, 'name': { 'ns': { 'ast_class': 'PublicNamespace'
55+
, 'name': '' }
56+
, 'id': 'Lex' } }
57+
, { 'ast_class': 'NamespaceFixture'
58+
, 'ns': { 'ast_class': 'AnonymousNamespace'
59+
, 'name': 'Lex' } } ]
60+
, [ { 'ast_class': 'PropName'
61+
, 'name': { 'ns': { 'ast_class': 'PublicNamespace'
62+
, 'name': '' }
63+
, 'id': 'Gen' } }
64+
, { 'ast_class': 'NamespaceFixture'
65+
, 'ns': { 'ast_class': 'AnonymousNamespace'
66+
, 'name': 'Gen' } } ]
67+
, [ { 'ast_class': 'PropName'
68+
, 'name': { 'ns': { 'ast_class': 'PublicNamespace'
69+
, 'name': '' }
70+
, 'id': 'Util' } }
71+
, { 'ast_class': 'NamespaceFixture'
72+
, 'ns': { 'ast_class': 'AnonymousNamespace'
73+
, 'name': 'Util' } } ]
74+
, [ { 'ast_class': 'PropName'
75+
, 'name': { 'ns': { 'ast_class': 'PublicNamespace'
76+
, 'name': '' }
77+
, 'id': 'Abc' } }
78+
, { 'ast_class': 'NamespaceFixture'
79+
, 'ns': { 'ast_class': 'AnonymousNamespace'
80+
, 'name': 'Abc' } } ]
81+
, [ { 'ast_class': 'PropName'
82+
, 'name': { 'ns': { 'ast_class': 'PublicNamespace'
83+
, 'name': '' }
84+
, 'id': 'Asm' } }
85+
, { 'ast_class': 'NamespaceFixture'
86+
, 'ns': { 'ast_class': 'AnonymousNamespace'
87+
, 'name': 'Asm' } } ]
88+
, [ { 'ast_class': 'PropName'
89+
, 'name': { 'ns': { 'ast_class': 'PublicNamespace'
90+
, 'name': '' }
91+
, 'id': 'Emit' } }
92+
, { 'ast_class': 'NamespaceFixture'
93+
, 'ns': { 'ast_class': 'AnonymousNamespace'
94+
, 'name': 'Emit' } } ]
5395
, ]
5496
, 'exprs': [ ] }
5597
, 'block': { 'ast_class': 'Block'

esc-sanity.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
#./esc.sh tests/self/hello.es
2-
#/work/tamarin/bin/shell tests/self/hello.es.abc
3-
#./esc1.sh tests/self/if.es
4-
#/work/tamarin/bin/shell tests/self/if.es.abc
5-
#./esc.sh tests/self/for.es
6-
#/work/tamarin/bin/shell tests/self/for.es.abc
7-
#./esc.sh tests/self/try.es
8-
#/work/tamarin/bin/shell tests/self/try.es.abc
9-
#./esc.sh tests/self/cls.es
10-
#/work/tamarin/bin/shell tests/self/cls.es.abc
11-
#./esc.sh tests/self/switch.es
12-
#/work/tamarin/bin/shell tests/self/switch.es.abc
1+
./esc.sh tests/self/hello.es
2+
/work/tamarin/bin/shell tests/self/hello.es.abc
3+
./esc1.sh tests/self/if.es
4+
/work/tamarin/bin/shell tests/self/if.es.abc
5+
./esc.sh tests/self/for.es
6+
/work/tamarin/bin/shell tests/self/for.es.abc
7+
./esc.sh tests/self/try.es
8+
/work/tamarin/bin/shell tests/self/try.es.abc
9+
./esc.sh tests/self/cls.es
10+
/work/tamarin/bin/shell tests/self/cls.es.abc
11+
./esc.sh tests/self/switch.es
12+
/work/tamarin/bin/shell tests/self/switch.es.abc
1313
./esc.sh tests/self/switchtype.es
1414
/work/tamarin/bin/shell tests/self/switchtype.es.abc
15-

esc1.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cp $1 esc-tmp.es
2-
make run-dumped FILE="tests/self/debug.es tests/self/util.es tests/self/util-es4ri.es tests/self/ast.es tests/self/decoder.es tests/self/encoder.es tests/self/lexer.es tests/self/parser.es tests/self/esc1.es"
2+
make run-dumped FILE="tests/self/debug.es tests/self/util.es tests/self/util-es4ri.es tests/self/ast.es tests/self/decoder.es tests/self/encoder.es tests/self/lex-char.es tests/self/lex-token.es tests/self/lex-scan.es tests/self/parser.es tests/self/esc1.es"
33
cp esc-tmp.ast $1.1.ast
44
cp esc-tmp.ast $1.ast
55
rm esc-tmp.es
6-
rm esc-tmp.ast
6+
rm esc-tmp.ast
7+
8+

esc2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cp $1.ast esc-tmp.ast
22
cp $1.ast $1.1.ast
3-
make run-dumped FILE="tests/self/debug.es tests/self/ast.es tests/self/encoder.es tests/self/decoder.es tests/self/lexer.es tests/self/util.es tests/self/parser.es tests/self/util-es4ri.es esc-tmp.ast tests/self/esc2.es"
3+
make run-dumped FILE="tests/self/debug.es tests/self/ast.es tests/self/encoder.es tests/self/decoder.es tests/self/util.es tests/self/util-es4ri.es esc-tmp.ast tests/self/esc2.es"
44
cp esc-tmp.ast $1.ast
55
cp esc-tmp.ast $1.2.ast
66
diff -s $1.1.ast $1.2.ast

escp.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

run-cogentest.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
export TESTNAME="hello-test"
22
make run FILE="tests/self/debug.es tests/self/ast.es tests/self/ast_encoder.es tests/self/util.es tests/self/util-es4ri.es tests/self/bytestream.es tests/self/abcfile.es tests/self/assembler.es tests/self/emitter.es tests/self/cogen-stmt.es tests/self/cogen-expr.es tests/self/cogen.es tests/self/cogen_test.es tests/self/cogen-driver.es"
33

4-
#Uncomment below lines to run parser tests
5-
#TESTNAME="esc-tmp"
6-
#make run FILE="tests/self/debug.es tests/self/ast.es tests/self/ast_encoder.es tests/self/lexer.es tests/self/parser.es tests/self/util.es tests/self/util-es4ri.es tests/self/bytestream.es tests/self/abcfile.es tests/self/assembler.es tests/self/emitter.es tests/self/cogen-stmt.es tests/self/cogen-expr.es tests/self/cogen.es tests/self/esc-driver.es"
7-
84
java -cp c:/hg/my-asc-working/lib/asc.jar macromedia.asc.embedding.Main -d -m $TESTNAME.es
95

106
/cygdrive/c/hg/my-tamarin-central/platform/win32/obj_8/shell/Release_Debugger/avmplus_s.exe $TESTNAME.abc

run-esc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cp $1 esc-tmp.es
2-
make run-dumped FILE="tests/self/debug.es tests/self/ast.es tests/self/encoder.es tests/self/decoder.es tests/self/lexer.es tests/self/util.es tests/self/parser.es tests/self/util-es4ri.es tests/self/bytestream.es tests/self/abcfile.es tests/self/assembler.es tests/self/emitter.es tests/self/cogen-stmt.es tests/self/cogen-expr.es tests/self/cogen.es tests/self/esc.es"
2+
make run-dumped FILE="tests/self/debug.es tests/self/ast.es tests/self/encoder.es tests/self/decoder.es tests/self/lex-char.es tests/self/lex-token.es tests/self/lex-scan.es tests/self/util.es tests/self/parser.es tests/self/util-es4ri.es tests/self/bytestream.es tests/self/abcfile.es tests/self/assembler.es tests/self/emitter.es tests/self/cogen-stmt.es tests/self/cogen-expr.es tests/self/cogen.es tests/self/esc.es"
33

44
cp esc-tmp.il $1.il
55
cp esc-tmp.abc $1.abc

tests/self/abcfile.es

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* -*- mode: java; mode: font-lock; tab-width: 4; insert-tabs-mode: nil; indent-tabs-mode: nil -*- */
12
/* ***** BEGIN LICENSE BLOCK *****
23
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
34
*

tests/self/assembler.es

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* -*- mode: java; mode: font-lock; tab-width: 4; insert-tabs-mode: nil; indent-tabs-mode: nil -*- */
12
/* ***** BEGIN LICENSE BLOCK *****
23
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
34
*
@@ -128,6 +129,7 @@ package assembler
128129
* depth.
129130
* - Ditto for the scope depth, really.
130131
*/
132+
131133
public class AVM2Assembler
132134
{
133135
const listify = true;
@@ -623,14 +625,14 @@ package assembler
623625
}
624626

625627
private function stack(n) {
626-
current_stack_depth += n;
628+
current_stack_depth = current_stack_depth + n;
627629
if (current_stack_depth > max_stack_depth) {
628630
max_stack_depth = current_stack_depth;
629631
}
630632
}
631633

632634
private function scope(n) {
633-
current_scope_depth += n;
635+
current_scope_depth = current_scope_depth + n;
634636
if (current_scope_depth > max_scope_depth)
635637
max_scope_depth = current_scope_depth;
636638
}

0 commit comments

Comments
 (0)