View Code? Open in Web Editor
NEW
This project forked from scymtym/leap-parser
Embryonic parser for the leap file format
leap-parser's Introduction
- Load the system
(ql:quickload :leap-parser)
- Some example input
(defparameter *input*
(alexandria:read-file-into-string
(asdf:system-relative-pathname :leap-parser "examples/test.leap")))
(princ *input*)
# Comment
logFile leap.log
addAtomTypes {
{ "H" "H" "sp3" }
}
HOH = TP3
- Parse it, constructing the result syntax tree using the
list
builder
(architecture.builder-protocol:with-builder ('list)
(esrap:parse 'leap-parser::leap *input*))
(:LEAP
(:INSTRUCTION
(((:COMMENT NIL :CONTENT " Comment" :BOUNDS (0 . 9)))
((:FUNCTION
(:ARGUMENT (((:LITERAL NIL :VALUE "leap.log" :BOUNDS (19 . 27))))) :NAME
"logFile" :BOUNDS (11 . 27)))
((:FUNCTION
(:ARGUMENT
(((:LIST
(:ELEMENT
(((:LIST
(:ELEMENT
(((:LITERAL NIL :VALUE "H" :BOUNDS (48 . 51)))
((:LITERAL NIL :VALUE "H" :BOUNDS (54 . 57)))
((:LITERAL NIL :VALUE "sp3" :BOUNDS (58 . 63)))))
:BOUNDS (46 . 65)))))
:BOUNDS (42 . 67)))))
:NAME "addAtomTypes" :BOUNDS (29 . 67)))
((:ASSIGNMENT (:VALUE (((:LITERAL NIL :VALUE "TP3" :BOUNDS (75 . 78)))))
:NAME "HOH" :BOUNDS (69 . 78)))))
:BOUNDS (0 . 78))
NIL
T
leap-parser's People
Contributors