[Laszlo-dev] For Review: Change 20071121-dda-W Summary: Initial compiler changes to support SWF9
Donald Anderson
dda at ddanderson.com
Wed Nov 21 12:47:47 PST 2007
Change 20071121-dda-W by dda at freddie.local on 2007-11-21 13:45:03 EST
in /Users/dda/laszlo/src/svn/openlaszlo/branches/devildog
for http://svn.openlaszlo.org/openlaszlo/branches/devildog
Summary: Initial compiler changes to support SWF9
New Features: SWF9 platform support in compiler only
Bugs Fixed: LPP-5064, LPP-5020, LPP-5021, LPP-5022
Technical Reviewer: ptw
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation: None yet, this is a development branch.
Probably will refer to ECMAScript document for any new language
features.
Release Notes: None yet, this will be sensible to do when we are
further along, and not working in a development branch.
Details:
This is the first cut of changes to support SWF9. The essential
change is to support creation of named classes, separate file
compilation,
running an external compiler and error line number tracking.
Note this change is in the devildog branch. Devildog was recently
merged with trunk, so these changes are 'up to date' with respect
to trunk.
This is ongoing work, there are about a dozen TODOs marked in the code
to be done as next steps. There are also a clear number of other
items to
accomplish: make this work (do the SWF9 compilation) when invoked
from a browser,
show errors to browsers, handle more interesting programs, support more
language features (e.g. final), integrate with SWF9 kernel and
runtime library work,
provide a compilation mode for building the runtime library (?), etc.
Tests:
To run the tests in an arbitrary system, you need:
1) A flash9 compiler. For testing, we are using the Flex
Compiler Shell,
calling the compc and mxmlc scripts. In theory, another
compilation
system could be used with some small programming changes; but
at the
moment, our code is not independent of the command line
interface provided by the flex tools. The location of the
flex tools is listed as properties in lps.properties:
compiler.swf9.lib.builder=../../flex2/bin/compc
compiler.swf9.app.builder=../../flex2/bin/mxmlc
After downloading flex, install it anywhere, and create a
symbolic link
from lps/flex2 to the top of the installation tree in order to
work with the properties given above.
2) A SWF9 runtime, if you want to produce a .SWF output file.
For the moment, I am testing with a small 'fake' runtime
that defines a number of classes used by small programs in
a trivial way. So trivial in fact, that the programs produced
compile and link but do not do anything useful when they run.
This runtime can be provided if needed for test scaffolding,
but is not included in this submission. We expect the runtime
to be installed into lps/inclues/lfc/LFC9.swc . If it is missing
the compilation will fail.
Currently, I am only running the compiler via lzc, and all compilation
errors appear on stderr. To show warnings as well, change in
lps.properties:
compiler.swf9.warnings=true
At the moment, there are many warnings due to untyped variables.
Given the setup above, the following trivial programs
have been compiled/linked to SWF9 output files (using lzc):
test/hello.lzx
test/trycatch.lzx
test/typevar.lzx
Perhaps others in test will also compile, but probably only if they
are limited to canvas, text, view elements. The compilation of more
interesting programs is limited by:
1) the use of additional parts of the laszlo runtime not handled
by the fake runtime.
2) some code emitted by the tag compiler that is inappropriate
for SWF9
3) (possibly) some other language related problems.
Going forward, it is 2 and 3 that we are interested in, some progress
on 1
may be made but only to expose problems in 2 and 3.
Files:
M WEB-INF/lps/config/lps.properties
M WEB-INF/lps/server/src/org/openlaszlo/sc/ReferenceCollector.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptCompiler.java
A WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/CommonGenerator.java
A WEB-INF/lps/server/src/org/openlaszlo/sc/
SWF9ParseTreePrinter.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/Translator.java
A WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
A WEB-INF/lps/server/src/org/openlaszlo/sc/TranslationUnit.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/ViewCompiler.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/
ElementCompiler.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryWriter.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
M WEB-INF/lps/server/src/org/openlaszlo/compiler/
ScriptElementCompiler.java
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
SimpleNode.java
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
ASTOperator.java
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
ASTLiteral.java
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/
ASTIdentifier.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20071121-dda-
W.tar
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
Voice: 617-547-7881
Email: dda at ddanderson.com
WWW: http://www.ddanderson.com
More information about the Laszlo-dev
mailing list