init: Spoofax language project as generated
This commit is contained in:
commit
79b9392173
20 changed files with 452 additions and 0 deletions
26
trans/analysis.str
Normal file
26
trans/analysis.str
Normal file
|
@ -0,0 +1,26 @@
|
|||
module analysis
|
||||
|
||||
imports
|
||||
|
||||
nabl2/api
|
||||
nabl2/runtime
|
||||
|
||||
statics
|
||||
|
||||
pp
|
||||
|
||||
rules // Analysis
|
||||
|
||||
editor-analyze = nabl2-analyze(id)
|
||||
|
||||
rules // Debugging
|
||||
|
||||
// Prints the abstract syntax ATerm of a selection.
|
||||
debug-show-aterm: (selected, _, _, path, project-path) -> (filename, result)
|
||||
with filename := <guarantee-extension(|"aterm")> path
|
||||
; result := selected
|
||||
|
||||
// Prints the analyzed annotated abstract syntax ATerm of a selection.
|
||||
debug-show-analyzed: (selected, _, _, path, project-path) -> (filename, result)
|
||||
with filename := <guarantee-extension(|"analyzed.aterm")> path
|
||||
; result := selected
|
15
trans/outline.str
Normal file
15
trans/outline.str
Normal file
|
@ -0,0 +1,15 @@
|
|||
module outline
|
||||
|
||||
imports
|
||||
|
||||
signatures/Spoofax-Propositional-Language-sig
|
||||
libspoofax/editor/outline
|
||||
|
||||
rules
|
||||
|
||||
editor-outline:
|
||||
(_, _, ast, path, project-path) -> outline
|
||||
where
|
||||
outline := <simple-label-outline(to-outline-label)> ast
|
||||
|
||||
to-outline-label = fail
|
49
trans/pp.str
Normal file
49
trans/pp.str
Normal file
|
@ -0,0 +1,49 @@
|
|||
module pp
|
||||
|
||||
imports
|
||||
|
||||
libstratego-gpp
|
||||
libspoofax/sdf/pp
|
||||
libspoofax/editor/refactoring/-
|
||||
pp/Spoofax-Propositional-Language-parenthesize
|
||||
pp/Spoofax-Propositional-Language-pp
|
||||
|
||||
rules
|
||||
|
||||
editor-format:
|
||||
(node, _, ast, path, project-path) -> (filename, result)
|
||||
with
|
||||
ext := <get-extension> path
|
||||
; filename := <guarantee-extension(|$[pp.[ext]])> path
|
||||
; result := <pp-debug> node
|
||||
|
||||
rules
|
||||
|
||||
pp-Spoofax-Propositional-Language-string =
|
||||
parenthesize-Spoofax-Propositional-Language
|
||||
; prettyprint-Spoofax-Propositional-Language-start-symbols
|
||||
; !V([], <id>)
|
||||
; box2text-string(|120)
|
||||
|
||||
pp-partial-Spoofax-Propositional-Language-string =
|
||||
parenthesize-Spoofax-Propositional-Language
|
||||
; prettyprint-Spoofax-Propositional-Language
|
||||
; !V([], <id>)
|
||||
; box2text-string(|120)
|
||||
|
||||
pp-partial-Spoofax-Propositional-Language-string(|sort) =
|
||||
parenthesize-Spoofax-Propositional-Language
|
||||
; prettyprint-Spoofax-Propositional-Language(|sort)
|
||||
; !V([], <id>)
|
||||
; box2text-string(|120)
|
||||
|
||||
pp-debug :
|
||||
ast -> result
|
||||
with
|
||||
result := <pp-Spoofax-Propositional-Language-string> ast
|
||||
<+ <bottomup(try(not(is-string); not(is-list); not(pp-Spoofax-Propositional-Language-string); debug(!"cannot pp ")))> ast
|
||||
; result := ""
|
||||
|
||||
rules
|
||||
|
||||
construct-textual-change = construct-textual-change(pp-partial-Spoofax-Propositional-Language-string, parenthesize, override-reconstruction, resugar)
|
16
trans/spoofax_propositional_language.str
Normal file
16
trans/spoofax_propositional_language.str
Normal file
|
@ -0,0 +1,16 @@
|
|||
module spoofax_propositional_language
|
||||
|
||||
imports
|
||||
|
||||
completion/completion
|
||||
pp
|
||||
outline
|
||||
analysis
|
||||
|
||||
rules // Debugging
|
||||
|
||||
debug-show-aterm:
|
||||
(node, _, _, path, project-path) -> (filename, result)
|
||||
with
|
||||
filename := <guarantee-extension(|"aterm")> path
|
||||
; result := node
|
13
trans/statics.nabl2
Normal file
13
trans/statics.nabl2
Normal file
|
@ -0,0 +1,13 @@
|
|||
module statics
|
||||
|
||||
imports
|
||||
|
||||
signatures/-
|
||||
|
||||
rules
|
||||
|
||||
init ^ (s) := new s.
|
||||
|
||||
[[ Empty() ^ (s) ]] :=
|
||||
false | note "Specify name binding and typing rules in statics.nabl2".
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue