aboutsummaryrefslogtreecommitdiff
path: root/new-luxc
diff options
context:
space:
mode:
authorEduardo Julian2017-05-07 15:26:09 -0400
committerEduardo Julian2017-05-07 15:26:09 -0400
commit08eb05f23914194c3adcc141664d4c2d7d88978c (patch)
tree73b61370c672f8b1a6bb9f7af429ef6a2617e9aa /new-luxc
parentdb697bb636e2341d26bb188cc1b9981a1ab505d7 (diff)
- Renamed "AST" to "Code".
Diffstat (limited to 'new-luxc')
-rw-r--r--new-luxc/source/luxc/analyser/lux.lux16
-rw-r--r--new-luxc/source/luxc/compiler.lux4
-rw-r--r--new-luxc/source/luxc/compiler/expr.jvm.lux2
-rw-r--r--new-luxc/source/luxc/compiler/statement.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang.lux4
-rw-r--r--new-luxc/source/luxc/parser.lux38
-rw-r--r--new-luxc/test/test/luxc/parser.lux28
7 files changed, 48 insertions, 48 deletions
diff --git a/new-luxc/source/luxc/analyser/lux.lux b/new-luxc/source/luxc/analyser/lux.lux
index 86f9839dc..f0e9a3538 100644
--- a/new-luxc/source/luxc/analyser/lux.lux
+++ b/new-luxc/source/luxc/analyser/lux.lux
@@ -94,7 +94,7 @@
(analyse-definition cursor reference)))
(def: #export (analyse-check analyse eval cursor type value)
- (-> Analyser Eval Cursor AST AST (Lux Analysis))
+ (-> Analyser Eval Cursor Code Code (Lux Analysis))
(do Monad<Lux>
[actual (eval Type type)
#let [actual (:! Type actual)]
@@ -105,7 +105,7 @@
(analyse eval value))))
(def: #export (analyse-coerce analyse eval cursor type value)
- (-> Analyser Eval Cursor AST AST (Lux Analysis))
+ (-> Analyser Eval Cursor Code Code (Lux Analysis))
(do Monad<Lux>
[actual (eval Type type)
#let [actual (:! Type actual)]
@@ -117,8 +117,8 @@
(wrap (&common;replace-type actual =value))))
(def: (analyse-typed-tuple analyse cursor members)
- (-> (-> AST (Lux Analysis)) Cursor
- (List AST)
+ (-> (-> Code (Lux Analysis)) Cursor
+ (List Code)
(Lux Analysis))
(do Monad<Lux>
[expected macro;expected-type]
@@ -174,8 +174,8 @@
(#lang;Structure (#lang;Tuple members))]))
(def: #export (analyse-tuple analyse cursor members)
- (-> (-> AST (Lux Analysis)) Cursor
- (List AST)
+ (-> (-> Code (Lux Analysis)) Cursor
+ (List Code)
(Lux Analysis))
(do Monad<Lux>
[expected macro;expected-type]
@@ -218,8 +218,8 @@
)))
(def: #export (analyse-variant analyse cursor tag value)
- (-> (-> AST (Lux Analysis)) Cursor
- Nat AST
+ (-> (-> Code (Lux Analysis)) Cursor
+ Nat Code
(Lux Analysis))
(do Monad<Lux>
[expected macro;expected-type]
diff --git a/new-luxc/source/luxc/compiler.lux b/new-luxc/source/luxc/compiler.lux
index 67a9928fd..8d0ea8a2f 100644
--- a/new-luxc/source/luxc/compiler.lux
+++ b/new-luxc/source/luxc/compiler.lux
@@ -15,7 +15,7 @@
))
(def: (compile ast)
- (-> AST (Lux Unit))
+ (-> Code (Lux Unit))
(case ast
(^ [_ (#;Form (list [_ (#;Symbol ["" "_lux_def"])]
[_ (#;Symbol ["" def-name])]
@@ -61,7 +61,7 @@
(wrap output)))
(def: parse
- (Lux AST)
+ (Lux Code)
(function [compiler]
(case (&parser;parse (get@ #;source compiler))
(#E;Error error)
diff --git a/new-luxc/source/luxc/compiler/expr.jvm.lux b/new-luxc/source/luxc/compiler/expr.jvm.lux
index 138d0d540..f0508c0d2 100644
--- a/new-luxc/source/luxc/compiler/expr.jvm.lux
+++ b/new-luxc/source/luxc/compiler/expr.jvm.lux
@@ -23,7 +23,7 @@
(undefined))
(def: #export (compile input)
- (-> AST (Lux Compiled))
+ (-> Code (Lux Compiled))
(|> input
(&analyser;analyse eval)
(Lux/map &synthesizer;synthesize)
diff --git a/new-luxc/source/luxc/compiler/statement.jvm.lux b/new-luxc/source/luxc/compiler/statement.jvm.lux
index 0e53ba37d..7e48d061f 100644
--- a/new-luxc/source/luxc/compiler/statement.jvm.lux
+++ b/new-luxc/source/luxc/compiler/statement.jvm.lux
@@ -12,14 +12,14 @@
(compiler ["&;" expr])))
(def: #export (compile-def def-name def-value def-meta)
- (-> Text AST AST (Lux Unit))
+ (-> Text Code Code (Lux Unit))
(do Monad<Lux>
[=def-value (&expr;compile def-value)
=def-meta (&expr;compile def-meta)]
(undefined)))
(def: #export (compile-program prog-args prog-body)
- (-> Text AST (Lux Unit))
+ (-> Text Code (Lux Unit))
(do Monad<Lux>
[=prog-body (&env;with-local [prog-args (type (List Text))]
(&expr;compile prog-body))]
diff --git a/new-luxc/source/luxc/lang.lux b/new-luxc/source/luxc/lang.lux
index 0c5c97192..787895466 100644
--- a/new-luxc/source/luxc/lang.lux
+++ b/new-luxc/source/luxc/lang.lux
@@ -38,7 +38,7 @@
Unit)
(type: #export Eval
- (-> Type AST (Lux Top)))
+ (-> Type Code (Lux Top)))
(type: #export Analyser
- (-> Eval AST (Lux Analysis)))
+ (-> Eval Code (Lux Analysis)))
diff --git a/new-luxc/source/luxc/parser.lux b/new-luxc/source/luxc/parser.lux
index 0115d1924..c9ba89b75 100644
--- a/new-luxc/source/luxc/parser.lux
+++ b/new-luxc/source/luxc/parser.lux
@@ -1,7 +1,7 @@
## This is the LuxC's parser.
## It takes the source code of a Lux file in raw text form and
## extracts the syntactic structure of the code from it.
-## It only produces Lux AST nodes, and thus removes any white-space
+## It only produces Lux Code nodes, and thus removes any white-space
## and comments while processing its inputs.
## Another important aspect of the parser is that it keeps track of
@@ -21,7 +21,7 @@
## They are supposed to produce some parsed output, alongside an
## updated cursor pointing to the end position, after the parser was run.
-## Lux AST nodes/tokens are annotated with cursor meta-data
+## Lux Code nodes/tokens are annotated with cursor meta-data
## (file-name, line, column) to keep track of their provenance and
## location, which is helpful for documentation and debugging.
@@ -139,7 +139,7 @@
(l;either (single-line-comment^ where)
(multi-line-comment^ where)))
-## To simplify parsing, I remove any left-padding that an AST token
+## To simplify parsing, I remove any left-padding that an Code token
## may have prior to parsing the token itself.
## Left-padding is assumed to be either white-space or a comment.
## The cursor gets updated, but the padding gets ignored.
@@ -208,7 +208,7 @@
## standard library to actually produce the values from the literals.
(do-template [<name> <tag> <lexer> <codec>]
[(def: #export (<name> where)
- (-> Cursor (Lexer [Cursor AST]))
+ (-> Cursor (Lexer [Cursor Code]))
(do Monad<Lexer>
[chunk <lexer>]
(case (:: <codec> decode chunk)
@@ -249,7 +249,7 @@
## This parser doesn't delegate the work of producing the value to a
## codec, since the raw-char^ parser already takes care of that magic.
(def: #export (parse-char where)
- (-> Cursor (Lexer [Cursor AST]))
+ (-> Cursor (Lexer [Cursor Code]))
(do Monad<Lexer>
[[chunk value] (l;enclosed ["#\"" "\""]
raw-char^)]
@@ -259,7 +259,7 @@
## This parser looks so complex because text in Lux can be multi-line
## and there are rules regarding how this is handled.
(def: #export (parse-text where)
- (-> Cursor (Lexer [Cursor AST]))
+ (-> Cursor (Lexer [Cursor Code]))
(do Monad<Lexer>
[## Lux text "is delimited by double-quotes", as usual in most
## programming languages.
@@ -346,15 +346,15 @@
## Form and tuple syntax is mostly the same, differing only in the
## delimiters involved.
-## They may have an arbitrary number of arbitrary AST nodes as elements.
+## They may have an arbitrary number of arbitrary Code nodes as elements.
(do-template [<name> <tag> <open> <close>]
[(def: (<name> where parse-ast)
(-> Cursor
- (-> Cursor (Lexer [Cursor AST]))
- (Lexer [Cursor AST]))
+ (-> Cursor (Lexer [Cursor Code]))
+ (Lexer [Cursor Code]))
(do Monad<Lexer>
[_ (l;text <open>)
- [where' elems] (loop [elems (: (V;Vector AST)
+ [where' elems] (loop [elems (: (V;Vector Code)
V;empty)
where where]
(l;either (do @
@@ -384,16 +384,16 @@
## Semantically, though, records and tuples are just 2 different
## representations for the same thing (a tuple).
## In normal Lux syntax, the key position in the pair will be a tag
-## AST node, however, record AST nodes allow any AST node to occupy
-## this position, since it may be useful when processing AST syntax in
+## Code node, however, record Code nodes allow any Code node to occupy
+## this position, since it may be useful when processing Code syntax in
## macros.
(def: (parse-record where parse-ast)
(-> Cursor
- (-> Cursor (Lexer [Cursor AST]))
- (Lexer [Cursor AST]))
+ (-> Cursor (Lexer [Cursor Code]))
+ (Lexer [Cursor Code]))
(do Monad<Lexer>
[_ (l;text "{")
- [where' elems] (loop [elems (: (V;Vector [AST AST])
+ [where' elems] (loop [elems (: (V;Vector [Code Code])
V;empty)
where where]
(l;either (do @
@@ -428,7 +428,7 @@
## possible).
## In particular, no white-space can be used, and neither can other
## characters which are already used by Lux as delimiters for other
-## AST nodes (thereby reducing ambiguity while parsing).
+## Code nodes (thereby reducing ambiguity while parsing).
## Additionally, the first character in an identifier's part cannot be
## a digit, to avoid confusion with regards to numbers.
(def: ident-part^
@@ -498,7 +498,7 @@
## construction and de-structuring (during pattern-matching).
(do-template [<name> <tag> <lexer> <extra>]
[(def: #export (<name> where)
- (-> Cursor (Lexer [Cursor AST]))
+ (-> Cursor (Lexer [Cursor Code]))
(do Monad<Lexer>
[[value length] <lexer>]
(wrap [(update@ #;column (|>. ($_ n.+ <extra> length)) where)
@@ -509,7 +509,7 @@
)
(def: (parse-ast where)
- (-> Cursor (Lexer [Cursor AST]))
+ (-> Cursor (Lexer [Cursor Code]))
(do Monad<Lexer>
[where (left-padding^ where)]
($_ l;either
@@ -528,7 +528,7 @@
)))
(def: #export (parse [where code])
- (-> [Cursor Text] (Error [[Cursor Text] AST]))
+ (-> [Cursor Text] (Error [[Cursor Text] Code]))
(case (l;run' code (parse-ast where))
(#E;Error error)
(#E;Error error)
diff --git a/new-luxc/test/test/luxc/parser.lux b/new-luxc/test/test/luxc/parser.lux
index 9f8584b2c..5218bb926 100644
--- a/new-luxc/test/test/luxc/parser.lux
+++ b/new-luxc/test/test/luxc/parser.lux
@@ -10,7 +10,7 @@
["E" error]
(coll [list]))
["R" math/random "R/" Monad<Random>]
- (macro [ast])
+ (macro [code])
test)
(luxc ["&" parser]))
@@ -39,15 +39,15 @@
(R;seq ident-part^ ident-part^))
(def: ast^
- (R;Random AST)
- (let [numeric^ (: (R;Random AST)
+ (R;Random Code)
+ (let [numeric^ (: (R;Random Code)
($_ R;either
(|> R;bool (R/map (|>. #;Bool [default-cursor])))
(|> R;nat (R/map (|>. #;Nat [default-cursor])))
(|> R;int (R/map (|>. #;Int [default-cursor])))
(|> R;deg (R/map (|>. #;Deg [default-cursor])))
(|> R;real (R/map (|>. #;Real [default-cursor])))))
- textual^ (: (R;Random AST)
+ textual^ (: (R;Random Code)
($_ R;either
(|> R;char (R/map (|>. #;Char [default-cursor])))
(do R;Monad<Random>
@@ -55,7 +55,7 @@
(|> (R;text size) (R/map (|>. #;Text [default-cursor]))))
(|> ident^ (R/map (|>. #;Symbol [default-cursor])))
(|> ident^ (R/map (|>. #;Tag [default-cursor])))))
- simple^ (: (R;Random AST)
+ simple^ (: (R;Random Code)
($_ R;either
numeric^
textual^))]
@@ -64,7 +64,7 @@
(let [multi^ (do R;Monad<Random>
[size (|> R;nat (R/map (n.% +3)))]
(R;list size ast^))
- composite^ (: (R;Random AST)
+ composite^ (: (R;Random Code)
($_ R;either
(|> multi^ (R/map (|>. #;Form [default-cursor])))
(|> multi^ (R/map (|>. #;Tuple [default-cursor])))
@@ -78,12 +78,12 @@
(test: "Lux code parser."
[sample ast^]
(assert "Can parse Lux code."
- (case (&;parse [default-cursor (ast;to-text sample)])
+ (case (&;parse [default-cursor (code;to-text sample)])
(#E;Error error)
false
(#E;Success [_ parsed])
- (:: ast;Eq<AST> = parsed sample))
+ (:: code;Eq<Code> = parsed sample))
))
(def: comment-text^
@@ -148,21 +148,21 @@
false
(#E;Success [_ parsed])
- (:: ast;Eq<AST> =
+ (:: code;Eq<Code> =
parsed
- (ast;text good-output)))))
+ (code;text good-output)))))
(assert "Can handle comments."
(case (&;parse [default-cursor
- (format comment (ast;to-text sample))])
+ (format comment (code;to-text sample))])
(#E;Error error)
false
(#E;Success [_ parsed])
- (:: ast;Eq<AST> = parsed sample)))
+ (:: code;Eq<Code> = parsed sample)))
(assert "Will reject unbalanced multi-line comments."
(and (case (&;parse [default-cursor
(format "#(" "#(" unbalanced-comment ")#"
- (ast;to-text sample))])
+ (code;to-text sample))])
(#E;Error error)
true
@@ -170,7 +170,7 @@
false)
(case (&;parse [default-cursor
(format "#(" unbalanced-comment ")#" ")#"
- (ast;to-text sample))])
+ (code;to-text sample))])
(#E;Error error)
true