about summary refs log blame commit diff stats
path: root/src/index.js
blob: 1da4f5c6e1e664b6ac15a667e2ac0a908f44c266 (plain) (tree)
1
2
3
4
5
6
7
import App from "./App.svelte";

let app = new App({
  target: document.body,
});

export default App;
an>(<exp-elem>) ((expr :accessor expr))) (defclass <elem-bin> (<exp-elem>) ((bin-op :accessor bin-op))) (defclass <elem-unr> (<exp-elem>) ((unr-op :accessor unr-op))) (defclass <elem-lp> (<exp-elem) ()) (defun unr-symb (s) (cond ((string= s "!") 'not) ((string= s "-") 'uminus) (t (error "Parse error")))) (defun bin-symb (s) (cond ((string= s "+") 'plus) ((string= s "-") 'minus) ((string= s "*") 'mult) ((string= s "/") 'div) ((string= s "%") 'mod) ((string= s "=") 'equal) ((string= s "<") 'less) ((string= s "<=") 'lesseq) ((string= s ">") 'great))) (defun parse (str) (let* ((cl (make-instance (find-class '<string-lexer>) 's str)) (tok (lexer cl))) (cond ((instancep tok (find-class '<lint>)) (make-instance (find-class '<line>) 'n n 'c (parse-cmd cl))) ((instancep tok (find-class '<lident>)) (cond ((string= (ident tok) "LIST") (make-instance (find-class '<phrase-list>))) ((string= (ident tok) "RUN") (make-instance (find-class '<phrase-run>))) ((string= (ident tok) "END") (make-instance (find-class '<phrase-p-end>))) (t (error "Parse error")))) (t (error "Parse error"))))) (provide "cparse")