Commits

Ronny Pfannschmidt  committed 637d8a2

initial commit

  • Participants

Comments (0)

Files changed (2)

File buildit-syntax.pro

+:- op(1090, fx, tool).
+:- op(1080, xfx, will).
+:- op(1070, xfx, by).
+:- op(1060, fx, build).
+:- op(1050, yfx, from).
+:- op(1060, fx, executing).
+:- op(900, fx, [lib, bin, pkg, glob]).
+:- dynamic build_implicit/2.
+
+build
+    lib util
+    from
+        glob 'src/lib/*.c',
+        pkg 'gtk+'>='2.10.0'.
+build
+    bin test
+    from
+        lib util,
+        glob 'src/bin/*.c',
+        pkg 'gtk+'>='2.10.0'.
+
+
+tool gcc will
+    build '%.o'
+    from '%.c'
+    by executing 'gcc -c -o %.o %.c'.
+
+
+target(X, D) :- build X from D.
+targets(XL) :- findall(X, target(X, _), XL).
+
+comma2l(X,[X]) :- (_,_) \= X.
+comma2l((X, C), [X|R]) :- comma2l(C,R).
+
+:- findall(dt(X,D), (target(X,T), comma2l(T,D)), L), write(L).
+:- targets(XL), write(XL), nl.
+depends( X, Y ) :- target(X, D), comma2l(D, DL), member(Y, DL).
+
+depends_target(X,Y) :- depends( X,Y), target(Y,_).
+
+

File sql-syntax.pro

+:- op(1080, fx, select).
+:- op(1070, yfy, where).
+:- op(1060, yfy, from).
+:- op( 900, yfy, join).
+:- op( 850, yfy, on).
+:- op( 800, xfx, [or, and]).
+:- op( 100, yfy, like).
+:- dynamic (select)/1.
+
+
+select
+    users(id, name),
+    permission(name)
+from
+    users
+    join user_permissions
+        on user(id) = user_permissions(user_id)
+    join permissions
+        on permissions(id) = user_permissions(permission_id)
+where
+    users(id) = 1
+    or users(name) like 'M?yer'.
+
+:- (select X from Y where Z),
+    write_canonical(X),nl,
+    write_canonical(Y),nl,
+    write_canonical(Z),nl.
+
+:- write_canonical(select a from b where c).
+