Skip to content

Instantly share code, notes, and snippets.

@CinchBlue
Created February 17, 2018 03:23
Show Gist options
  • Save CinchBlue/1bb113ca6db563ded6124e6c6c578896 to your computer and use it in GitHub Desktop.
Save CinchBlue/1bb113ca6db563ded6124e6c6c578896 to your computer and use it in GitHub Desktop.
/myuser/home/ $ mkdir shock-project
/myuser/home/ $ cd shock-project
~/shock-project/ $ shock
! New project.
% @
$ ins proc main
% <module> .. proc main() { }
$ show more
% <module> <..>
% < .proc : Proc[_] > : proc
% < .name : Str > : main
% < .args : (Var) > : ()
% < .body : (Expr) > : {}
$$ .args ins argc: Int
% proc main (argc: Int) { }
$$ .args ins argv:Arr[Str]
% <module> .. proc main (argc: Int, argv: Array[Str]) { }
$$ fc .body
% main .. { }
$$$ ins:
% main .. { @ }
$$$ let x = 1
% main .. {
%% let x = 1
%% @
% }
$$$ let y = 2
% main .. {
%% let x = 1
%% let y = 2
%% @
% }
$$$ in ../main
% let main = proc (argc: Int, argv: Array[Str]) { <.body> }
$$$(../main) use /std/io
% let main = proc (argc: Int, argv: Array[Str])
% uses /std/io/
% { <.body> }
%
$$$(../main)
$$$(../main)
! Going back to /module/main/body
% main .. {
%% let x = 1
%% let y = 2
%% @
% }
$$$ in //prompt { show 'path'
! //prompt: now showing path
% main .. {
%% let x = 1
%% let y = 2
%% @
% }
(//prompt) $(.) }
(/module/main/body/2) $ println (sum x y)
% main .. {
%% let x = 1
%% let y = 2
%% println (sum x y)
%% @
% }
(/module/main/body/3) $ return 0
! End of path.
% main .. {
%% let x = 1
%% let y = 2
%% println (sum x y)
%% return 0
% }
(/module/main/body) $ 1
% main .. {
%% @ (let x = 1)
%% let y = 2
%% println (sum x y)
%% return 0
% }
(/module/main/body/x) $ set .name = 'hello'
% main .. {
%% @ (let hello = 1)
%% let y = 2
%% println (sum x y)
%% return 0
% }
(/module/main/body/hello) $
(/module/main/body/hello) $
% main .. {
%% let hello = 1
%% let y = 2
%% println (sum x y)
%% return 0
% }
(/module/main/body) $ in .y { set .name = 'world' }
% main .. {
%% let hello = 1
%% let world = 2
%% println (sum x y)
%% return 0
% }
(/module/main/body) $ in .z { set .name = 'foo' }
! Error: Proc.InvalidVariable (in .z)
! No variable 'z' exists in the current scope.
(/module/main/body) $ destroy asdfklwre
! Error: CommandLine.UndefinedCommand (destroy)
! The command 'destroy' is not defined.
(/module/main/body) $ focus /module
% proc main (argc: Int, argv: Array[Str]) { <.body> }
(/module) $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment