Fix for hex literal reader bug #25

Closed
wants to merge 91 commits into
from

Conversation

Projects
None yet
4 participants
@Gozala

Gozala commented Jan 20, 2013

No description provided.

kanaka added some commits Nov 16, 2012

Start of ClojureScript compiler in ClojureScript.
Compile like this:

rm -rf out/; bin/cljsc bs.cljs > bs.js && \
    bin/cljsc src/cljs/cljs/compiler.cljs > compiler.js && \
    bin/cljsc src/cljs/cljs/reader.cljs > reader.js

Then load comp.html. You will have a rep JavaScript function which
will read, eval and print:

    rep("(+ 1 1)");

CAVEAT: macros are not yet supported.
Add chouser's jsrepl modified to use the analyzer/compiler.
Build like this:

cd web
../bin/cljsc ../src/cljs/jsrepl.cljs > jsrepl.js
CLJS compiler and REPL working in Node.js
Compile and run the CLJS REPL:
    cd node
    ../bin/cljsc ../src/cljs/noderepl.cljs > noderepl.js
    cp ../src/cljs/goog.js out/
    ./run.js noderepl.js

Compile and run the the CLJS compiler wrapper:
    cd node
    ../bin/cljsc ../src/cljs/nodecljs.cljs > nodecljs.js
    cp ../src/cljs/goog.js out/
    ./run.js nodecljs.js hello.cljs

The :nodejs compilation target is currently broken. However, the
node/run.js bootstrap script enables compiled CLJS code to be
invoked that was not compiled with a :target.

Also, rename the jsrepl.cljs to webrepl.cljs to disambiguate with the
node.js equivalent (noderepl.js).
Generate analyzer namespace snapshot while compiling.
This replaces the hardcoded bs.cljs file that only
provided cljs.core and cljs.user for the analyzer.

In order to load the snapshot, in Javascript (either in web/jsrepl.html
for web based or node/run.js) we set cljs.analyzer.namespaces to point
to cljs.namespaces (the snapshot built up during compilation).
Move namespaces to cljs.core and "refer" it from cljs.analyzer.
This removes the need for the custom Javascript code in the bootstrap
files and in the namespace snapshot code.
Add macro support to JS built cljs analyzer/compiler.
This doesn't yet enable defining and immediate use of macros during
JVM based analyze/compile of cljs.

In other words, in the live Node.js and web REPL you can define new
macros and use them via the REPL. However, you can't define them yet
in a file, analyzer/compile it and then use them during or after
analyze/compile.
Move PushbackReader to core.cljs.
In normal Clojure this comes from java so it makes sense to put it in
core.cljs to make it more widely available (analyzer.cljs and
compiler.cljs will want this when they begin supporting whole files).
Properly munge symbols to JS names in get-expander.
Downside is that this creates an implicit dependency of cljs.analyzer
on cljs.compiler (munge).
Add destructure and Clojure core macros.
Add macros from Clojure core (specifically src/clj/clojure/core.clj).

In order to eval macros during analysis, we :use-macros to include
clj-defmacro which is then used to define precompile/analyzed macros
for later use at runtime.

Some minor changes have to be made to the macros to make them work
in ClojureScript via clj-defmacro:

- Use cljs.core/* symbols explicitly within syntax quoted sections of
  the macros.
- Convert java exceptions to Javascript exceptions.
- Stub out any code that tries to apply metadata to var/symbols.

Macros added:

- Add non destructuring stubs for let, loop.

- Add macros from Clojure (JVM) core:
    defn, when, when-not, cond, if-not, and, or, ->, ->>, if-let,
    when-let, doto, memfn, fn, when-first, comment, while, letfn.
Add ClojureScript core macros.
This adds macros from ClojureScript (specifically
src/clj/cljs/core.clj) to the runtime.

- Add destructuring forms of let and loop

- Other macros added:
    satisfies?, binding, lazy-seq, delay, condp, case, try, assert,
    for, doseq, amap, areduce, dotimes, time, with-out-str
Misc node and web REPL fixes/cleanup.
- Save last exception as noderepl/*e or webrepl/*e.
- Split ep function out of pep in webrepl to match noderepl.
- Don't throw EOF error in noderepl when line is blank.
Make symbols first class objects rather than prefixed strings.
Specifically this allows symbols to have metadata. This is widely used
for communicating metadata among the type/protocol macros and the
analyzer. The downside is that symbol map keys can be slower because
in Javascript objects cannot be used as attribute keys. This means
that a slower path is used for objects that contain symbols as keys.
Add array macros and add commented out '.. and 'js-obj
This brings core.cljs more in sync with core from
Clojure/ClojureScript core.clj
Add type/protocol macros from ClojureScript core.clj
Add these macros and supporting functions/macros.

reify, extend-type, deftype, defrecord, defprotocol

kanaka and others added some commits Jan 5, 2013

Add load-file, forms-seq, compile-forms*.
load-file is similar to the Clojure version but returns a map of
compile info rather than the result of the final form in the file.
load-file* returns the same map but includes :emit-str (the emitted
Javascript) and :output (any output printed during load, rather than
printing it directly).
Add quick.cljs test to cover basics quickly.
At the REPL load and run like this:

> (load-file "../test/cljs/cljs/quick.cljs")
> (runt-tests)
Merge pull request #1 from Gozala/selfhosted/regexp
Fix for regexps containing / character
Merge pull request #2 from Gozala/selfhosted/travis
Configure travis.ci integration tests.
Merge pull request #3 from Gozala/selfhosted/debug-print
Print read & analysed forms in debug mode.
Update README, REPL debug, quick.cljs tests.
- Update bugs and TODOs in README.
- Separately print the read, analyzed and emitted code so that if it
  breaks after one step the intermediate results are still output.
- Add a regex test for fixed cases. Remove a couple of redundant tests
  (this focus is quick after all). Add a case for the time macro.
Revert "Move PushbackReader to core.cljs."
This reverts commit eaa8eeb.

Having it in core.cljs doesn't really clean up dependencies and there
are tighter relationships between the push-back-reader and the other
read functions in reader.cljs.

Conflicts:

	src/cljs/cljs/core.cljs
Add File/file ops to io.cljs. Restore analyzer/compiler file routines.
- Add File type, file I/O, path operations to src/cljs/cljs/io.cljs.
- Restore analyze-file in analyzer.cljs
- Restore compile-file, compile-root and other file related functions
  to compiler.cljs.
- Copy ns-snap (namespace snapshot) from src/clj/cljs/compiler.cljs to
  compile-file*.
Merge pull request #5 from Gozala/selfhosted/print-regexp
Fix: regexes with forward slashes are printed with extra escaping
Merge pull request #11 from arthuredelstein/cljs_in_cljs
use the same font for input and output code
Cleanup web and node REPL/compiler bootstrap code.
Move the pre-compiled bootstrap code from JavaScript to the .cljs
files.
Merge pull request #13 from arthuredelstein/a5a849fef5bcfcc0a79d0d1e1…
…2989e621e44cb12

Support in web REPL for *1, *2, *3
Add web REPL UI based on Himera.
- Import base HTML, stylesheets and images from Himera
  (https://github.com/fogus/himera). Also, import synonym.html
  sibling file that has JavaScript to ClojureScript translations.
- Add src/cljs/webrepl2.cljs that implements the new REPL.

The new REPL can be built like this:

    cd web
    ../bin/cljsc ../src/cljs/webrepl2.cljs > webrepl2.js

Then open web/repl.html. The new REPL page has a much better design
and style with the reference/links from the Himera front page. The
REPL window is based on jquery.console and has history (up arrow)
support.
Minor modifications.
 * Made header link and tweaked style to support that
 * Added attribution
Fix division symbol.
- In ns-snap munge the cljs.core// symbol before and after read-string
  to avoid the Clojure-side exception.
- For cljs.core/name and cljs.core/namespace, correctly handle / and
  cljs.core//. This brings these functions in sync with
  clojure/src/jvm/clojure/lang/Symbol.java
Merge pull request #17 from Gozala/bug/numeric-keywords
Write keyword tests for #16 (numeric keywords)

@Gozala Gozala closed this Jan 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment