aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser/proc.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-05-15 22:19:14 -0400
committerEduardo Julian2017-05-15 22:19:14 -0400
commit824482b2e8b13e42a524a5e4945ea3e172395c9e (patch)
tree959bb7684461318b1026cd773ae29ac76d426054 /new-luxc/source/luxc/analyser/proc.lux
parent04c0a8d2fceae628099673e62527fc48e2afd7e7 (diff)
WIP
- Simplified the Analysis type, by removing all meta-data. - Added analysis of function calls. - Added analysis of common Lux procedures. - Lots of refactoring.
Diffstat (limited to 'new-luxc/source/luxc/analyser/proc.lux')
-rw-r--r--new-luxc/source/luxc/analyser/proc.lux20
1 files changed, 20 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/analyser/proc.lux b/new-luxc/source/luxc/analyser/proc.lux
new file mode 100644
index 000000000..8bd975272
--- /dev/null
+++ b/new-luxc/source/luxc/analyser/proc.lux
@@ -0,0 +1,20 @@
+(;module:
+ lux
+ (lux (control monad)
+ (data ["E" error]
+ [text]
+ text/format
+ (coll ["D" dict])
+ maybe))
+ (luxc ["&" base]
+ (lang ["la" analysis #+ Analysis]))
+ (. ["&&;" lux]))
+
+(def: #export (analyse-proc analyse [proc-category proc-name] proc-args)
+ (-> &;Analyser Ident (List Code) (Lux Analysis))
+ (default (let [proc-description (format "[" (%t proc-category) " " (%t proc-name) "]")]
+ (&;fail (format "Unknown procedure: " proc-description)))
+ (do Monad<Maybe>
+ [procs (D;get proc-category &&lux;procs)
+ proc (D;get proc-name procs)]
+ (wrap (proc analyse proc-args)))))