├── .gitignore ├── .hgignore ├── AUTHORS.txt ├── CMakeLists.txt ├── ChangeLog.txt ├── LICENSE.txt ├── README.md ├── cmake ├── FindMercurial.cmake └── PCHsupport.cmake ├── compiler ├── CMakeLists.txt ├── analyzer.cpp ├── analyzer.hpp ├── analyzer_op.cpp ├── analyzer_op.hpp ├── checkedcast.hpp ├── clay.cpp ├── clay.hpp ├── claydoc.cpp ├── claydoc.hpp ├── clone.cpp ├── clone.hpp ├── codegen.cpp ├── codegen.hpp ├── codegen_op.cpp ├── codegen_op.hpp ├── constructors.cpp ├── constructors.hpp ├── desugar.cpp ├── desugar.hpp ├── env.cpp ├── env.hpp ├── error.cpp ├── error.hpp ├── evaluator.cpp ├── evaluator.hpp ├── evaluator_op.cpp ├── evaluator_op.hpp ├── externals.cpp ├── externals.hpp ├── hirestimer.cpp ├── hirestimer.hpp ├── html.cpp ├── int128.hpp ├── interactive.cpp ├── invoketables.cpp ├── invoketables.hpp ├── lambdas.cpp ├── lambdas.hpp ├── lexer.cpp ├── lexer.hpp ├── literals.cpp ├── literals.hpp ├── loader.cpp ├── loader.hpp ├── matchinvoke.cpp ├── matchinvoke.hpp ├── objects.cpp ├── objects.hpp ├── operators.hpp ├── parachute.cpp ├── parachute.hpp ├── parser.cpp ├── parser.hpp ├── patterns.cpp ├── patterns.hpp ├── pch.cpp ├── printer.cpp ├── printer.hpp ├── profiler.cpp ├── profiler.hpp ├── refcounted.hpp ├── refcounted_ut.cpp ├── style.css ├── types.cpp ├── types.hpp ├── ut.hpp └── ut_main.cpp ├── doc ├── language-reference.md └── primitives-reference.md ├── editor-support ├── SyntaxHighlightingExample.clay ├── emacs │ ├── README.txt │ └── clay-mode.el ├── gtksourceview │ ├── Makefile │ ├── README.md │ ├── clay.lang │ └── clay.xml └── vim │ ├── README.txt │ ├── ftdetect │ └── clay.vim │ ├── plugin │ └── clay.vim │ └── syntax │ └── clay.vim ├── examples ├── cocoa │ ├── appkit │ │ ├── Info.plist │ │ ├── MainMenu.nib │ │ │ ├── designable.nib │ │ │ └── keyedobjects.nib │ │ ├── Makefile │ │ └── example.clay │ ├── qtkit │ │ └── example.clay │ └── uikit │ │ └── Example │ │ ├── Example-Info.plist │ │ ├── Example.xcodeproj │ │ └── project.pbxproj │ │ ├── MainWindow.xib │ │ └── example.clay ├── factorial.clay ├── hello.clay ├── libchello.clay ├── opengl │ ├── clear-context-static.clay │ ├── clear-context.clay │ ├── clear-static.clay │ └── clear.clay ├── shootout │ ├── binarytrees │ │ ├── Makefile │ │ ├── binarytrees.c │ │ ├── binarytrees.clay │ │ ├── binarytrees.cpp │ │ └── binarytrees.java │ ├── fannkuch │ │ ├── Makefile │ │ ├── fannkuch.c │ │ ├── fannkuch.clay │ │ ├── fannkuch.cpp │ │ └── fannkuch.java │ ├── mandelbrot │ │ ├── Makefile │ │ ├── mandelbrot.c │ │ ├── mandelbrot.clay │ │ ├── mandelbrot.cpp │ │ ├── mandelbrot.java │ │ └── mandelbrot_non_simd.clay │ ├── nbody │ │ ├── Makefile │ │ ├── nbody.c │ │ ├── nbody.clay │ │ ├── nbody.cpp │ │ └── nbody.java │ └── spectralnorm │ │ ├── Makefile │ │ ├── spectralnorm.c │ │ ├── spectralnorm.clay │ │ ├── spectralnorm.cpp │ │ ├── spectralnorm.java │ │ └── spectralnorm_non_simd.clay ├── tinyhello.clay └── win32 │ ├── beep.clay │ └── wndproc.clay ├── lib-clay ├── atomics │ ├── atomics.clay │ └── platform │ │ └── platform.x86.clay ├── buffervector │ └── buffervector.clay ├── byteorder │ ├── byteorder.clay │ ├── byteorder.x86.32.clay │ ├── byteorder.x86.64.clay │ ├── common │ │ └── common.clay │ ├── constants │ │ └── constants.clay │ └── platform │ │ ├── platform.arm.clay │ │ ├── platform.clay │ │ ├── platform.ppc.clay │ │ ├── platform.sparc.clay │ │ └── platform.x86.clay ├── cocoa │ ├── appkit │ │ ├── appkit.clay │ │ └── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ └── generated_from.h │ ├── applicationservices │ │ ├── applicationservices.clay │ │ └── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ ├── generated_from_arm.h │ │ │ └── generated_from_x86.h │ ├── audiotoolbox │ │ ├── audiotoolbox.clay │ │ └── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ └── generated_from.h │ ├── cocoa.macosx.clay │ ├── coreaudio │ │ ├── coreaudio.clay │ │ └── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ ├── generated_from_arm.h │ │ │ └── generated_from_x86.h │ ├── corefoundation │ │ ├── corefoundation.clay │ │ └── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ └── generated_from.h │ ├── coreservices │ │ ├── coreservices.clay │ │ └── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ ├── generated_from_arm.h │ │ │ └── generated_from_x86.h │ ├── foundation │ │ ├── foundation.clay │ │ └── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ └── generated_from.h │ ├── nib │ │ └── nib.clay │ ├── objc │ │ ├── objc.clay │ │ ├── platform │ │ │ ├── platform.arm.clay │ │ │ ├── platform.x86.32.clay │ │ │ └── platform.x86.64.clay │ │ └── runtime │ │ │ └── runtime.clay │ ├── qtkit │ │ ├── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ └── generated_from.h │ │ └── qtkit.clay │ ├── quartzcore │ │ ├── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ ├── generated.macosx.x86.32.clay │ │ │ ├── generated.macosx.x86.64.clay │ │ │ └── generated_from.h │ │ └── quartzcore.clay │ ├── test │ │ └── test.clay │ ├── uikit │ │ ├── generated │ │ │ ├── Makefile │ │ │ ├── generated.macosx.arm.clay │ │ │ └── generated_from.h │ │ └── uikit.clay │ ├── util │ │ ├── platform │ │ │ ├── platform.macosx.arm.clay │ │ │ └── platform.macosx.x86.clay │ │ └── util.clay │ └── webkit │ │ ├── generated │ │ ├── Makefile │ │ ├── generated.macosx.x86.32.clay │ │ ├── generated.macosx.x86.64.clay │ │ └── generated_from.h │ │ └── webkit.clay ├── commandline │ ├── dispatch │ │ └── dispatch.clay │ └── options │ │ ├── options.clay │ │ ├── parser.clay │ │ ├── spec.clay │ │ ├── table.clay │ │ └── util.clay ├── comparators │ └── comparators.clay ├── complex │ └── complex.clay ├── console │ └── color.clay ├── core │ ├── arrays │ │ └── arrays.clay │ ├── booleans │ │ └── booleans.clay │ ├── bytes │ │ └── bytes.clay │ ├── characters │ │ └── characters.clay │ ├── complex │ │ └── complex.clay │ ├── coordinates │ │ └── coordinates.clay │ ├── core.clay │ ├── enumerations │ │ └── enumerations.clay │ ├── errors │ │ ├── backtrace │ │ │ ├── backtrace.clay │ │ │ └── platform │ │ │ │ ├── platform.clay │ │ │ │ └── platform.unix.clay │ │ └── errors.clay │ ├── exceptions │ │ └── exceptions.clay │ ├── libc │ │ ├── libc.freebsd.32.clay │ │ ├── libc.freebsd.64.clay │ │ ├── libc.linux.32.clay │ │ ├── libc.linux.64.clay │ │ ├── libc.macosx.x86.32.clay │ │ ├── libc.macosx.x86.64.clay │ │ ├── libc.windows.32.clay │ │ └── libc.windows.64.clay │ ├── maybe │ │ └── maybe.clay │ ├── memory │ │ ├── memory.clay │ │ └── platform │ │ │ ├── platform.clay │ │ │ └── platform.macosx.clay │ ├── numbers │ │ ├── numbers.clay │ │ └── overflow │ │ │ └── overflow.clay │ ├── operators │ │ ├── operators.clay │ │ └── pod │ │ │ └── pod.clay │ ├── platform │ │ ├── cpu │ │ │ ├── cpu.arm.clay │ │ │ ├── cpu.mips.32.clay │ │ │ ├── cpu.ppc.32.clay │ │ │ ├── cpu.ppc.64.clay │ │ │ ├── cpu.x86.32.clay │ │ │ └── cpu.x86.64.clay │ │ ├── os │ │ │ ├── os.freebsd.clay │ │ │ ├── os.linux.clay │ │ │ ├── os.macosx.clay │ │ │ └── os.windows.clay │ │ ├── platform.clay │ │ └── symbols │ │ │ └── symbols.clay │ ├── pointers │ │ └── pointers.clay │ ├── ranges │ │ └── ranges.clay │ ├── records │ │ └── records.clay │ ├── sequences │ │ └── sequences.clay │ ├── statics │ │ └── statics.clay │ ├── strings │ │ ├── cstringrefs │ │ │ └── cstringrefs.clay │ │ ├── stringliterals │ │ │ └── stringliterals.clay │ │ ├── stringrefs │ │ │ └── stringrefs.clay │ │ └── strings.clay │ ├── system │ │ ├── platform │ │ │ ├── platform.clay │ │ │ ├── testing.clay │ │ │ ├── testing.unix.clay │ │ │ └── testing.windows.clay │ │ └── system.clay │ ├── tuples │ │ └── tuples.clay │ ├── types │ │ ├── platform │ │ │ ├── platform.32.clay │ │ │ ├── platform.64.clay │ │ │ ├── platform.windows.32.clay │ │ │ └── platform.windows.64.clay │ │ └── types.clay │ ├── unions │ │ └── unions.clay │ ├── values │ │ └── values.clay │ └── variants │ │ ├── nested │ │ └── nested.clay │ │ └── variants.clay ├── crypto │ └── digest │ │ ├── digest.clay │ │ ├── internal │ │ └── internal.clay │ │ ├── md5 │ │ └── md5.clay │ │ └── sha2 │ │ └── sha2.clay ├── data │ ├── algorithms │ │ ├── algorithms.clay │ │ ├── heaps │ │ │ └── heaps.clay │ │ ├── introsort │ │ │ └── introsort.clay │ │ ├── permutations │ │ │ └── permutations.clay │ │ └── strings │ │ │ └── strings.clay │ ├── any │ │ └── any.clay │ ├── deques │ │ └── deques.clay │ ├── hashmaps │ │ └── hashmaps.clay │ ├── queues │ │ └── queues.clay │ ├── sequences │ │ ├── force │ │ │ └── force.clay │ │ ├── handle │ │ │ └── handle.clay │ │ ├── lazy │ │ │ ├── enumerated │ │ │ │ └── enumerated.clay │ │ │ ├── filtered │ │ │ │ └── filtered.clay │ │ │ ├── grouped │ │ │ │ └── grouped.clay │ │ │ ├── lazy.clay │ │ │ ├── mapped │ │ │ │ └── mapped.clay │ │ │ ├── reversed │ │ │ │ └── reversed.clay │ │ │ ├── sliced │ │ │ │ └── sliced.clay │ │ │ └── zipped │ │ │ │ └── zipped.clay │ │ ├── operators │ │ │ └── operators.clay │ │ ├── sequences.clay │ │ └── util │ │ │ └── util.clay │ ├── strings │ │ ├── encodings │ │ │ └── utf8 │ │ │ │ └── utf8.clay │ │ ├── strings.clay │ │ └── tempcstrings │ │ │ └── tempcstrings.clay │ └── vectors │ │ ├── generic │ │ └── generic.clay │ │ └── vectors.clay ├── defaultarguments │ └── defaultarguments.clay ├── destructors │ └── destructors.clay ├── expat │ ├── constants │ │ └── constants.clay │ ├── expat.clay │ └── generated │ │ ├── Makefile │ │ ├── generated.clay │ │ └── generated_from.h ├── externals │ └── externals.clay ├── glut │ ├── glut.clay │ └── platform │ │ ├── platform.clay │ │ └── platform.windows.clay ├── hash │ └── hash.clay ├── hints │ └── hints.clay ├── interfaces │ └── interfaces.clay ├── io │ ├── errors │ │ └── errors.clay │ ├── files │ │ ├── api │ │ │ └── api.clay │ │ ├── easy │ │ │ └── easy.clay │ │ ├── files.clay │ │ ├── lines │ │ │ └── lines.clay │ │ └── raw │ │ │ ├── platform │ │ │ ├── platform.unix.clay │ │ │ └── platform.windows.clay │ │ │ └── raw.clay │ ├── filesystem │ │ ├── executable │ │ │ ├── executable.clay │ │ │ └── executable.linux.clay │ │ ├── filesystem.clay │ │ └── platform │ │ │ ├── common │ │ │ └── common.clay │ │ │ ├── platform.unix.clay │ │ │ └── platform.windows.clay │ ├── mapping │ │ ├── mapping.unix.clay │ │ └── mapping.windows.clay │ ├── sockets │ │ ├── platform │ │ │ ├── platform.unix.clay │ │ │ └── platform.windows.clay │ │ └── sockets.clay │ ├── streams │ │ ├── buffered │ │ │ └── buffered.clay │ │ ├── bytevector │ │ │ └── bytevector.clay │ │ ├── memory │ │ │ └── memory.clay │ │ ├── protocol │ │ │ └── protocol.clay │ │ └── streams.clay │ └── temp │ │ ├── platform │ │ ├── platform.unix.clay │ │ └── platform.windows.clay │ │ └── temp.clay ├── keywordarguments │ └── keywordarguments.clay ├── lambdas │ └── lambdas.clay ├── libc │ ├── generated │ │ ├── Makefile │ │ ├── generated.freebsd.32.clay │ │ ├── generated.freebsd.64.clay │ │ ├── generated.linux.32.clay │ │ ├── generated.linux.64.clay │ │ ├── generated.macosx.arm.clay │ │ ├── generated.macosx.x86.32.clay │ │ ├── generated.macosx.x86.64.clay │ │ ├── generated.windows.32.clay │ │ ├── generated.windows.64.clay │ │ ├── generated_from_unix.h │ │ └── generated_from_win32.h │ ├── libc.freebsd.clay │ ├── libc.linux.clay │ ├── libc.macosx.clay │ ├── libc.windows.32.clay │ └── libc.windows.64.clay ├── llvm │ └── libclang │ │ ├── generated │ │ ├── Makefile │ │ ├── generated.clay │ │ └── generated_from.h │ │ └── libclang.clay ├── math │ ├── bigfloat │ │ └── bigfloat.clay │ ├── libm │ │ └── libm.clay │ ├── math.clay │ ├── native │ │ ├── abs.clay │ │ ├── abscomplex.clay │ │ ├── acos.clay │ │ ├── acosh.clay │ │ ├── arg.clay │ │ ├── asin.clay │ │ ├── asinh.clay │ │ ├── atan.clay │ │ ├── atan2.clay │ │ ├── atanh.clay │ │ ├── bessel.clay │ │ ├── beta.clay │ │ ├── cbrt.clay │ │ ├── ceil.clay │ │ ├── constants.clay │ │ ├── copysign.clay │ │ ├── cos.clay │ │ ├── cosh.clay │ │ ├── cot.clay │ │ ├── erf.clay │ │ ├── exp.clay │ │ ├── exp2.clay │ │ ├── expm1.clay │ │ ├── floor.clay │ │ ├── fmod.clay │ │ ├── fpclassify.clay │ │ ├── frexp.clay │ │ ├── gamma.clay │ │ ├── hypot.clay │ │ ├── ilogb.clay │ │ ├── kernel │ │ │ ├── ieee754.clay │ │ │ ├── k_cexp.clay │ │ │ ├── k_exp.clay │ │ │ ├── k_log.clay │ │ │ ├── k_rem_pio2.clay │ │ │ └── k_trig.clay │ │ ├── ldexp.clay │ │ ├── llround.clay │ │ ├── log.clay │ │ ├── log10.clay │ │ ├── log1p.clay │ │ ├── log2.clay │ │ ├── modf.clay │ │ ├── native.clay │ │ ├── nextafter.clay │ │ ├── pow.clay │ │ ├── proj.clay │ │ ├── protocol.clay │ │ ├── rem_pio2.clay │ │ ├── rint.clay │ │ ├── round.clay │ │ ├── scalbn.clay │ │ ├── sign.clay │ │ ├── sin.clay │ │ ├── sinh.clay │ │ ├── sinpi.clay │ │ ├── sqrt.clay │ │ ├── sqrt.x86.clay │ │ ├── tan.clay │ │ ├── tanh.clay │ │ └── trunc.clay │ └── simd │ │ └── simd.x86.clay ├── numbers │ ├── floats │ │ └── floats.clay │ └── parser │ │ ├── errno │ │ ├── errno.unix.clay │ │ └── errno.windows.clay │ │ └── parser.clay ├── opengl │ ├── enums │ │ └── enums.clay │ ├── lookup │ │ └── lookup.clay │ ├── nolookup │ │ └── nolookup.clay │ ├── opengl.clay │ ├── platform │ │ ├── platform.macosx.clay │ │ ├── platform.unix.clay │ │ └── platform.windows.clay │ └── types │ │ └── types.clay ├── os │ └── errors │ │ ├── errors.clay │ │ └── platform │ │ ├── platform.unix.clay │ │ └── platform.windows.clay ├── paged │ ├── allocator │ │ └── allocator.clay │ ├── misc │ │ └── misc.clay │ ├── namedscalars │ │ └── namedscalars.clay │ ├── namedvectors │ │ └── namedvectors.clay │ ├── paged.clay │ ├── sharedpointers │ │ └── sharedpointers.clay │ ├── strings │ │ └── strings.clay │ └── vectors │ │ └── vectors.clay ├── parsing │ └── combinators │ │ ├── generic │ │ └── generic.clay │ │ ├── strings │ │ └── strings.clay │ │ └── wrapper │ │ └── wrapper.clay ├── prelude │ ├── prelude.clay │ └── repl │ │ └── repl.clay ├── printer │ ├── exceptions │ │ └── exceptions.clay │ ├── formatter │ │ └── formatter.clay │ ├── observe │ │ └── observe.clay │ ├── platform │ │ ├── platform.clay │ │ └── platform.windows.clay │ ├── printer.clay │ ├── protocol │ │ └── protocol.clay │ └── types │ │ └── types.clay ├── random │ └── random.clay ├── referencetypes │ └── referencetypes.clay ├── remote │ ├── marshaling │ │ └── marshaling.clay │ └── messages │ │ └── messages.clay ├── sharedpointers │ └── sharedpointers.clay ├── simd │ ├── primitives │ │ └── primitives.clay │ └── simd.clay ├── test │ ├── fuzz │ │ └── fuzz.clay │ ├── memory │ │ └── memory.clay │ ├── memory2 │ │ └── memory2.clay │ ├── module │ │ └── module.clay │ └── test.clay ├── threads │ ├── condvars │ │ ├── condvars.clay │ │ ├── platform │ │ │ ├── platform.unix.clay │ │ │ └── platform.windows.clay │ │ └── protocol │ │ │ └── protocol.clay │ ├── core │ │ ├── core.clay │ │ └── platform │ │ │ ├── platform.unix.clay │ │ │ └── platform.windows.clay │ ├── future │ │ └── future.clay │ ├── locks │ │ ├── locks.clay │ │ ├── platform │ │ │ ├── platform.unix.clay │ │ │ └── platform.windows.clay │ │ └── protocol │ │ │ └── protocol.clay │ ├── threadlocal │ │ ├── platform │ │ │ └── platform.unix.clay │ │ └── threadlocal.clay │ └── threads.clay ├── time │ ├── platform │ │ ├── platform.freebsd.clay │ │ ├── platform.linux.clay │ │ ├── platform.macosx.clay │ │ └── platform.windows.clay │ └── time.clay ├── twohash │ ├── implementation │ │ └── implementation.clay │ └── twohash.clay ├── uniquepointers │ └── uniquepointers.clay ├── unix │ ├── constants │ │ ├── constants.freebsd.clay │ │ ├── constants.linux.clay │ │ └── constants.macosx.clay │ ├── errno │ │ ├── errno.freebsd.clay │ │ ├── errno.linux.clay │ │ └── errno.macosx.clay │ ├── errnonames │ │ ├── errnonames.freebsd.clay │ │ ├── errnonames.linux.clay │ │ └── errnonames.macosx.clay │ ├── generated │ │ ├── Makefile │ │ ├── generated.freebsd.32.clay │ │ ├── generated.freebsd.64.clay │ │ ├── generated.linux.32.clay │ │ ├── generated.linux.64.clay │ │ ├── generated.macosx.arm.clay │ │ ├── generated.macosx.x86.32.clay │ │ ├── generated.macosx.x86.64.clay │ │ ├── generated_from_freebsd.h │ │ ├── generated_from_linux.h │ │ └── generated_from_macosx.h │ └── unix.clay └── win32 │ ├── constants │ └── constants.clay │ ├── errno │ └── errno.clay │ ├── errorcodes │ └── errorcodes.clay │ ├── errornames │ └── errornames.clay │ ├── generated │ ├── Makefile │ ├── generated.windows.32.clay │ ├── generated.windows.64.clay │ └── generated_from.h │ ├── platform │ ├── platform.windows.32.clay │ └── platform.windows.64.clay │ ├── printer │ └── printer.clay │ └── win32.clay ├── misc ├── CMakeLists.txt ├── Xcode │ ├── CMakeLists.txt │ ├── Project Templates │ │ └── Clay │ │ │ ├── Cocoa Application │ │ │ ├── English.lproj │ │ │ │ ├── InfoPlist.strings │ │ │ │ └── MainMenu.xib │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___-Info.plist │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___ │ │ │ │ └── appdelegate.clay │ │ │ ├── ___PROJECTNAME___.xcodeproj │ │ │ │ ├── TemplateInfo.plist │ │ │ │ └── project.pbxproj │ │ │ └── main.clay │ │ │ ├── Cocoa Touch Application for iPad │ │ │ ├── MainWindow.xib │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___-Info.plist │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___ │ │ │ │ ├── appdelegate.clay │ │ │ │ └── viewcontroller.clay │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___ViewController.xib │ │ │ ├── ___PROJECTNAME___.xcodeproj │ │ │ │ ├── TemplateInfo.plist │ │ │ │ └── project.pbxproj │ │ │ └── main.clay │ │ │ └── Cocoa Touch Application for iPhone │ │ │ ├── MainWindow.xib │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___-Info.plist │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___ │ │ │ ├── appdelegate.clay │ │ │ └── viewcontroller.clay │ │ │ ├── ___PROJECTNAMEASIDENTIFIER___ViewController.xib │ │ │ ├── ___PROJECTNAME___.xcodeproj │ │ │ ├── TemplateInfo.plist │ │ │ └── project.pbxproj │ │ │ └── main.clay │ ├── README.txt │ ├── clay-xcodebuild │ └── objc-export │ │ ├── clay-objc-export │ │ └── cocoa │ │ ├── nib │ │ └── nib.clay │ │ ├── objc │ │ └── export │ │ │ └── export.clay │ │ └── util │ │ └── platform │ │ └── platform.clay ├── clay-pigeon.png └── clay-pigeon.svg ├── packages └── archlinux │ └── clay-git │ └── PKGBUILD ├── test ├── example │ ├── claydoc │ │ ├── main.clay │ │ └── out.txt │ ├── dll │ │ ├── testdll.clay │ │ └── testdllclient.clay │ ├── helloworld │ │ ├── main.clay │ │ └── out.txt │ ├── namedunions │ │ ├── main.clay │ │ └── out.txt │ ├── permissive │ │ ├── main.clay │ │ └── out.txt │ └── shootout │ │ ├── insertionsort1 │ │ ├── insertionsort.py │ │ ├── insertionsort1.cpp │ │ ├── main.clay │ │ └── out.txt │ │ ├── insertionsort2 │ │ ├── insertionsort2.cpp │ │ ├── main.clay │ │ └── out.txt │ │ ├── mean │ │ ├── main.clay │ │ ├── mean.go │ │ └── out.txt │ │ ├── quicksort1 │ │ ├── main.clay │ │ ├── out.txt │ │ ├── quicksort.c │ │ ├── quicksort.go │ │ └── quicksort.py │ │ └── quicksort2 │ │ ├── main.clay │ │ └── out.txt ├── lang │ ├── array │ │ └── test.clay │ ├── as │ │ └── asArguments │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── atomic │ │ └── primitives │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── bindings │ │ ├── ref │ │ │ └── 1 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ └── variadic │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── builtins │ │ ├── array │ │ │ └── test.clay │ │ ├── enum │ │ │ └── test.clay │ │ ├── record │ │ │ └── test.clay │ │ ├── stringliterals │ │ │ └── test.clay │ │ ├── tuple │ │ │ └── test.clay │ │ ├── union │ │ │ └── test.clay │ │ ├── values │ │ │ └── test.clay │ │ └── variant │ │ │ └── test.clay │ ├── callbyname │ │ ├── arg │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ └── variadic │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── fileLineColumn │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── recursive │ │ │ ├── cross │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── does-not-count │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── param-self │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── simple │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ └── two-in-one │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ └── singleAliasArgUnpackExpr │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── codepointers │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 3 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 30 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 31 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── 32 │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── computedrecords │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── custompredicate │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── customproperty │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── destructors │ │ ├── main.clay │ │ └── out.txt │ ├── dispatch │ │ ├── main.clay │ │ └── out.txt │ ├── enums │ │ └── predicates │ │ │ ├── compilererr.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── evaluator │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── issue319 │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── exceptions │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 3 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── arrays │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── catch │ │ │ ├── context │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── simple │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── custom │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── finally │ │ │ ├── goto │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── lambdas │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── onerror │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── rethrow │ │ │ ├── any │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── concrete │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── outside-catch │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── throw-with-context │ │ │ └── test.clay │ │ ├── unhandled │ │ │ ├── after-rethrow │ │ │ │ ├── err.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── core │ │ │ │ ├── err.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── printer │ │ │ │ ├── err.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ └── vectors │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── expr │ │ ├── eval │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── if │ │ │ ├── 1 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 2 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── 3 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── switch │ │ │ └── 1 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ └── while │ │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ │ └── 2 │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── externalmain │ │ ├── main.clay │ │ └── out.txt │ ├── flags │ │ ├── buildflags.txt │ │ ├── main.clay │ │ └── out.txt │ ├── floats │ │ ├── literals │ │ │ ├── long │ │ │ │ ├── main.unix.x86.clay │ │ │ │ ├── out.freebsd.txt │ │ │ │ └── out.txt │ │ │ ├── main-disabled.freebsd.clay │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── main.clay │ │ ├── out.txt │ │ └── parts │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── globalalias │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── predicates │ │ │ ├── 1 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ └── 2 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ ├── globalvariables │ │ ├── ctorsdtors │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── predicates │ │ │ ├── 1 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ └── 2 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ ├── instrinsic │ │ ├── getoverload │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── hints │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── staticname │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── lambda │ │ ├── noarg │ │ │ ├── noarg.clay │ │ │ └── out.txt │ │ └── variableastype │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── modules │ │ ├── attributes │ │ │ └── literaltypes │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── imports │ │ │ ├── aliasqualified │ │ │ │ ├── foo │ │ │ │ │ └── bar │ │ │ │ │ │ └── bas.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── ambiguous1 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── c.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── ambiguous2 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── ambiguous3 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── ambiguous4 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── ambiguous5 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── circular │ │ │ │ ├── bar.clay │ │ │ │ ├── compilererr.txt │ │ │ │ ├── foo.clay │ │ │ │ └── main.clay │ │ │ ├── collision1 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── collision2 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── disambiguated1 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── disambiguated2 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── disambiguated3 │ │ │ │ ├── a.clay │ │ │ │ ├── b.clay │ │ │ │ ├── foo.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── dotted1 │ │ │ │ ├── foo │ │ │ │ │ └── bar.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── dotted2 │ │ │ │ ├── foo.clay │ │ │ │ ├── foo │ │ │ │ │ └── bar.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── dotted3 │ │ │ │ ├── foo │ │ │ │ │ └── bar.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── dotted4 │ │ │ │ ├── foo │ │ │ │ │ └── bar.clay │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── issue266 │ │ │ │ ├── a.clay │ │ │ │ ├── a │ │ │ │ │ └── b.clay │ │ │ │ └── test.clay │ │ │ ├── publicqualified │ │ │ │ ├── compilererr.txt │ │ │ │ ├── foo.clay │ │ │ │ ├── foo │ │ │ │ │ └── bar.clay │ │ │ │ └── main.clay │ │ │ └── suggest │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── introspection │ │ │ ├── foo.clay │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── issue272 │ │ │ ├── foo.clay │ │ │ ├── foo │ │ │ │ └── bar.clay │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── name │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── multivalues │ │ ├── assignmismatch │ │ │ ├── 1 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── 2 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── 3 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── 4 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ └── 5 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── binding │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── bindingmismatch │ │ │ ├── 1 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ ├── 2 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ ├── 3 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ ├── 4 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ └── 5 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ ├── operators │ │ ├── bitwise │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── comparison │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── custom │ │ │ ├── foo.clay │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── custom2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── extendedassignment │ │ │ ├── butnottooextended1 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── butnottooextended2 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── extendedassignment2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── pod │ │ │ ├── initializers │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── test.clay │ │ ├── precedence │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── proxyassignment │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── overloads │ │ ├── declmismatch │ │ │ ├── param │ │ │ │ ├── 1-2 │ │ │ │ │ ├── compilererr.txt │ │ │ │ │ └── main.clay │ │ │ │ ├── 1-2v │ │ │ │ │ ├── compilererr.txt │ │ │ │ │ └── main.clay │ │ │ │ ├── 2-0 │ │ │ │ │ ├── compilererr.txt │ │ │ │ │ └── main.clay │ │ │ │ └── 2v-0 │ │ │ │ │ ├── compilererr.txt │ │ │ │ │ └── main.clay │ │ │ └── return │ │ │ │ ├── 1-2 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ │ └── 2-0 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── final │ │ │ ├── ambiguous │ │ │ │ ├── buildflags.txt │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── default │ │ │ │ ├── buildflags.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── unambiguous │ │ │ │ ├── buildflags.txt │ │ │ │ └── test.clay │ │ │ └── unambiguous2 │ │ │ │ ├── buildflags.txt │ │ │ │ └── test.clay │ │ ├── patterncallable │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── pred-eval-loop │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ ├── private │ │ │ ├── bad-with-interface │ │ │ │ ├── baz.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── bad-wo-interface │ │ │ │ ├── baz.clay │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ └── good │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── standalone │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ └── withinterface │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── patterns │ │ ├── arguments │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── main.clay │ │ └── out.txt │ ├── pointers │ │ └── indexing │ │ │ └── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── privateimports │ │ ├── foo.clay │ │ ├── main.clay │ │ └── out.txt │ ├── privatemain │ │ ├── main.clay │ │ └── out.txt │ ├── records │ │ ├── copyable-if-fields-copyable │ │ │ └── test.clay │ │ ├── initialization │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── movable-if-fields-movable │ │ │ └── test.clay │ │ ├── params │ │ │ ├── int-param │ │ │ │ └── test.clay │ │ │ ├── string-param │ │ │ │ └── test.clay │ │ │ └── tuple-of-string-param │ │ │ │ └── test.clay │ │ ├── predicates │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ └── variadics │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── returntypes │ │ ├── analyzer │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── implicit │ │ │ └── test.clay │ │ └── spec │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── staticassert │ │ ├── incond │ │ │ ├── correct │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── wrong │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── infunction │ │ │ ├── correct │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── wrong │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── inlambda │ │ │ ├── correct │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── wrong │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── message │ │ │ ├── good │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── wrong-when-assert │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ └── wrong-when-ok │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ └── toplevel │ │ │ ├── correct │ │ │ ├── main.clay │ │ │ └── out.txt │ │ │ └── wrong │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ ├── stmt │ │ ├── eval │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── for │ │ │ └── static │ │ │ │ └── forwarded │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── if │ │ │ └── static │ │ │ │ ├── eval │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ │ ├── if-else │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ │ ├── if-expr │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ │ ├── if-only │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ │ └── scope │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ └── switch │ │ │ ├── main.clay │ │ │ ├── multivalue │ │ │ ├── main.clay │ │ │ └── out.txt │ │ │ ├── out.txt │ │ │ └── strings │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── stringliterals │ │ ├── main.clay │ │ └── out.txt │ ├── throwingbranches │ │ ├── main.clay │ │ └── out.txt │ ├── tuples │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── emptytuple │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── equality │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── single │ │ │ ├── 1 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── 2 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── staticindexing │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ └── ref-rvalue │ │ │ │ └── test.clay │ │ └── types │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── types │ │ ├── newtype │ │ │ ├── equality │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── valueSize │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── uncategorized │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 3 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 4 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 5 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 6 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 7 │ │ │ ├── main.unix.clay │ │ │ └── out.txt │ │ ├── 8 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 9 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 10 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 11 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 12 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 13 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 14 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 15 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 16 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 17 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 18 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 19 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 20 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 21 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 22 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 24 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 33 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 34 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 39 │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ └── test.txt │ │ ├── 40 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 42 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 44 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 45 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── 46 │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── unions │ │ ├── main.clay │ │ └── out.txt │ ├── valuesemantics │ │ ├── main.clay │ │ └── out.txt │ └── variants │ │ ├── 1 │ │ ├── main.clay │ │ └── out.txt │ │ ├── 2 │ │ ├── main.clay │ │ └── out.txt │ │ ├── 3 │ │ ├── main.clay │ │ └── out.txt │ │ ├── 4 │ │ ├── main.clay │ │ └── out.txt │ │ ├── 5 │ │ ├── main.clay │ │ └── out.txt │ │ ├── closed │ │ ├── 1 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ └── empty │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ ├── dispatch │ │ └── callbyname │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── empty │ │ ├── compilererr.txt │ │ └── main.clay │ │ ├── equality │ │ ├── main.clay │ │ └── out.txt │ │ ├── initialization │ │ ├── main.clay │ │ └── out.txt │ │ ├── match │ │ ├── main.clay │ │ └── out.txt │ │ ├── nested │ │ ├── main.clay │ │ └── out.txt │ │ ├── predicates │ │ ├── compilererr.txt │ │ └── main.clay │ │ ├── recursive │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── 2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── subgraphassignment │ │ ├── main.clay │ │ └── out.txt │ │ └── variantref │ │ ├── main.clay │ │ └── out.txt ├── lib-clay │ ├── algorithms │ │ ├── count │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── main.clay │ │ ├── out.txt │ │ ├── permutations │ │ │ └── test.clay │ │ ├── sorting │ │ │ └── test.clay │ │ └── strings │ │ │ └── test.clay │ ├── atomics │ │ ├── casValue │ │ │ ├── buildflags.freebsd.txt │ │ │ ├── buildflags.linux.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── normallyUnalignedType │ │ │ ├── buildflags.freebsd.txt │ │ │ ├── buildflags.linux.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── normallyUnalignedType2 │ │ │ ├── buildflags.freebsd.txt │ │ │ ├── buildflags.linux.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── rmw │ │ │ ├── buildflags.freebsd.txt │ │ │ ├── buildflags.linux.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── byteorder │ │ └── test.clay │ ├── cocoa │ │ ├── corefoundation │ │ │ ├── buildflags.txt │ │ │ ├── main.macosx.clay │ │ │ └── out.txt │ │ ├── foundation │ │ │ ├── buildflags.txt │ │ │ ├── main.macosx.clay │ │ │ └── out.txt │ │ ├── objc │ │ │ ├── buildflags.txt │ │ │ ├── internals │ │ │ │ ├── buildflags.txt │ │ │ │ ├── foo.clay │ │ │ │ ├── test.macosx.clay │ │ │ │ └── zim │ │ │ │ │ └── zang.clay │ │ │ ├── main.macosx.clay │ │ │ ├── out.txt │ │ │ └── subclassing │ │ │ │ ├── buildflags.txt │ │ │ │ ├── main.macosx.clay │ │ │ │ └── out.txt │ │ ├── runtime │ │ │ ├── buildflags.txt │ │ │ ├── main.macosx.clay │ │ │ └── out.txt │ │ └── util │ │ │ ├── buildflags.txt │ │ │ └── test.macosx.clay │ ├── commandline │ │ ├── 1 │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ ├── out.windows.txt │ │ │ └── run.py │ │ ├── dispatch │ │ │ ├── err.txt │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ └── run.py │ │ └── options │ │ │ └── test.clay │ ├── comparators │ │ └── test.clay │ ├── complex │ │ └── constructor │ ├── core │ │ ├── arrays │ │ │ └── test.clay │ │ ├── characters │ │ │ └── 1 │ │ │ │ └── test.clay │ │ ├── coordinates │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── defaultvaluesemantics │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── exceptions │ │ │ └── genericexception │ │ │ │ └── test.clay │ │ ├── maybe │ │ │ └── test.clay │ │ ├── memory │ │ │ ├── allocateArray │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── allocateObject │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── copy │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── zeroObject │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── numbers │ │ │ ├── conversion │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── literals │ │ │ │ ├── toolarge │ │ │ │ │ ├── compilererr.txt │ │ │ │ │ └── main.clay │ │ │ │ └── toolarge2 │ │ │ │ │ ├── compilererr.txt │ │ │ │ │ └── main.clay │ │ │ ├── octal │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── overflow │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── quotient │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── test.clay │ │ ├── platform │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── stringrefs │ │ │ └── test.clay │ │ ├── strings │ │ │ ├── stringliterals │ │ │ │ └── test.clay │ │ │ └── test.clay │ │ └── values │ │ │ └── 1 │ │ │ └── test.clay │ ├── crypto │ │ └── digest │ │ │ ├── md5 │ │ │ └── test.clay │ │ │ └── sha2 │ │ │ └── test.clay │ ├── data │ │ ├── any │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── deques │ │ │ ├── buildflags.txt │ │ │ ├── main.clay │ │ │ ├── memory │ │ │ │ ├── buildflags.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── out.txt │ │ ├── hashmaps │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ ├── rvalueiteration │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── valueinitialization │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── queues │ │ │ └── test.clay │ │ ├── sequences │ │ │ ├── 1 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 2 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 3 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 4 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 5 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 6 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 7 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── arrayassignment │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── buffervector │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── concatenation │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── force │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── group │ │ │ │ └── test.clay │ │ │ ├── maybe │ │ │ │ └── test.clay │ │ │ ├── multivalued │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── operators │ │ │ │ └── test.clay │ │ │ ├── overloadpriority │ │ │ │ └── test.clay │ │ │ ├── predicates │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── ranges │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── staticsized │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── strict │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ └── strings │ │ │ ├── encodings │ │ │ └── utf8 │ │ │ │ └── test.clay │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── defaultarguments │ │ ├── main.clay │ │ └── out.txt │ ├── externals │ │ ├── abi │ │ │ ├── common │ │ │ │ ├── buildflags.txt │ │ │ │ ├── external_test.cpp │ │ │ │ ├── main.clay │ │ │ │ ├── out.txt │ │ │ │ └── run.py │ │ │ ├── complex │ │ │ │ ├── buildflags.txt │ │ │ │ ├── external_test.cpp │ │ │ │ ├── main.unix.clay │ │ │ │ ├── out.txt │ │ │ │ └── run.py │ │ │ ├── external_test.hpp │ │ │ ├── external_test.py │ │ │ ├── external_test_x86.hpp │ │ │ ├── newtypes │ │ │ │ ├── buildflags.txt │ │ │ │ ├── external_test.cpp │ │ │ │ ├── main.clay │ │ │ │ ├── out.txt │ │ │ │ └── run.py │ │ │ ├── x86_float80 │ │ │ │ ├── buildflags.txt │ │ │ │ ├── external_test.cpp │ │ │ │ ├── main.unix.x86.clay │ │ │ │ ├── out.freebsd.txt │ │ │ │ ├── out.txt │ │ │ │ └── run.py │ │ │ └── x86_sse │ │ │ │ ├── buildflags.txt │ │ │ │ ├── external_test.cpp │ │ │ │ ├── main-disabled.freebsd.x86.clay │ │ │ │ ├── main.unix.x86.clay │ │ │ │ ├── out.txt │ │ │ │ └── run.py │ │ ├── ccast │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── main.clay │ │ ├── makeexternalcodepointer │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── out.txt │ │ ├── recursiveccodepointer │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── recursivecodepointer │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── hash │ │ ├── scalars │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── variants │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── interfaces │ │ ├── constructors │ │ │ ├── 1 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ ├── 2 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ │ └── 3 │ │ │ │ ├── compilererr.txt │ │ │ │ └── main.clay │ │ ├── main.clay │ │ ├── out.txt │ │ └── outputmismatch │ │ │ ├── 1 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ └── 2 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ ├── io │ │ ├── files │ │ │ ├── 27 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 28 │ │ │ │ ├── main.clay │ │ │ │ ├── out.txt │ │ │ │ └── test.txt │ │ │ ├── 29 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── raw │ │ │ │ └── test.clay │ │ ├── filesystem │ │ │ ├── directories │ │ │ │ └── test.clay │ │ │ └── paths │ │ │ │ ├── platformspecific.unix.clay │ │ │ │ ├── platformspecific.windows.clay │ │ │ │ └── test.clay │ │ ├── sockets │ │ │ ├── addresses │ │ │ │ ├── buildflags.windows.txt │ │ │ │ └── test.clay │ │ │ ├── connections │ │ │ │ ├── buildflags.windows.txt │ │ │ │ ├── main.clay │ │ │ │ ├── out.txt │ │ │ │ └── run.py │ │ │ ├── reading │ │ │ │ ├── buildflags.windows.txt │ │ │ │ ├── main.clay │ │ │ │ ├── out.txt │ │ │ │ └── run.py │ │ │ └── valuesemantics │ │ │ │ ├── buildflags.windows.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── streams │ │ │ ├── ascollections │ │ │ │ └── test.clay │ │ │ ├── buffered │ │ │ │ └── test.clay │ │ │ ├── bytevector │ │ │ │ └── test.clay │ │ │ └── memory │ │ │ │ └── test.clay │ │ └── temp │ │ │ └── test.clay │ ├── keywordarguments │ │ ├── main.clay │ │ └── out.txt │ ├── lambdas │ │ ├── alias │ │ │ ├── 1 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 2 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ ├── 3 │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── vararg │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── argsyntax │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── basic │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── calldefined │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── calloutputtypes │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── dynamic │ │ │ ├── main.clay │ │ │ ├── makelambda │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── out.txt │ │ ├── mono │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── monoinputtypes │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── nooutputtypes │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── papply │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── stateless │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── stateless2 │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ └── vararg │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── libc │ │ └── setjmplongjmp │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── llvm │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 2 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 3 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 4 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── intrinsics │ │ │ ├── main.clay │ │ │ ├── nonexistent │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ │ ├── out.txt │ │ │ └── sse │ │ │ └── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── math │ │ ├── complex │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ └── out.windows.txt │ │ ├── libm │ │ │ ├── buildflags.txt │ │ │ └── test.clay │ │ ├── native │ │ │ └── test.clay │ │ └── sqrt │ │ │ ├── buildflags.txt │ │ │ ├── main.unix.clay │ │ │ └── out.txt │ ├── numbers │ │ └── parser │ │ │ ├── 1 │ │ │ └── test.clay │ │ │ └── float80 │ │ │ ├── main.unix.x86.clay │ │ │ └── out.txt │ ├── paged │ │ ├── 35 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 36 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── 37 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── 38 │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── parsing │ │ ├── calculator │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ └── run.py │ │ ├── combinators │ │ │ ├── generic │ │ │ │ └── test.clay │ │ │ └── strings │ │ │ │ └── test.clay │ │ ├── main.clay │ │ └── out.txt │ ├── printing │ │ ├── 1 │ │ │ └── test.clay │ │ ├── formatting │ │ │ └── test.clay │ │ ├── hideioerror │ │ │ └── test.clay │ │ ├── int128 │ │ │ ├── main-disabled.windows.64.clay │ │ │ ├── main.64.clay │ │ │ └── out.txt │ │ ├── lambdas │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── nan │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── observe │ │ │ ├── err.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── repr │ │ │ └── test.clay │ ├── random │ │ └── test.clay │ ├── referencetypes │ │ ├── main.clay │ │ └── out.txt │ ├── remote │ │ ├── marshaling │ │ │ └── test.clay │ │ └── messages │ │ │ └── simple │ │ │ ├── main.clay │ │ │ ├── out.txt │ │ │ └── run.py │ ├── simd │ │ ├── invalidtypes │ │ │ ├── compilererr.txt │ │ │ └── main.clay │ │ ├── main.clay │ │ ├── optimizationbug1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── out.txt │ ├── test │ │ ├── 1 │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── fuzz │ │ │ └── test.clay │ │ ├── module │ │ │ ├── main.clay │ │ │ └── out.txt │ │ └── repr │ │ │ ├── main.clay │ │ │ └── out.txt │ ├── threads │ │ ├── condvars │ │ │ ├── buildflags.freebsd.txt │ │ │ ├── buildflags.linux.txt │ │ │ ├── main.clay │ │ │ └── out.txt │ │ ├── core │ │ │ └── simple │ │ │ │ ├── buildflags.freebsd.txt │ │ │ │ ├── buildflags.linux.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ ├── future │ │ │ ├── buildflags.freebsd.txt │ │ │ ├── buildflags.linux.txt │ │ │ └── test.clay │ │ ├── locks │ │ │ ├── mutex │ │ │ │ ├── buildflags.freebsd.txt │ │ │ │ ├── buildflags.linux.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ │ └── spinlock │ │ │ │ ├── buildflags.freebsd.txt │ │ │ │ ├── buildflags.linux.txt │ │ │ │ ├── main.clay │ │ │ │ └── out.txt │ │ └── threadlocal │ │ │ ├── buildflags.freebsd.txt │ │ │ ├── buildflags.linux.txt │ │ │ ├── main.unix.clay │ │ │ └── out.txt │ ├── time │ │ ├── main.clay │ │ └── out.txt │ ├── twohash │ │ ├── main.clay │ │ └── out.txt │ └── uniquepointers │ │ ├── main.clay │ │ ├── out.txt │ │ └── uniquevalues │ │ ├── main.clay │ │ └── out.txt ├── regression │ └── 279 │ │ ├── compilererr.txt │ │ └── main.clay ├── runtests.py └── test-installation.py └── tools ├── CMakeLists.txt ├── bindgen.clay └── foo.h /compiler/analyzer_op.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "clay.hpp" 5 | 6 | namespace clay { 7 | 8 | 9 | MultiPValuePtr analyzePrimOp(PrimOpPtr x, MultiPValuePtr args); 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /compiler/checkedcast.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "assert.h" 5 | 6 | 7 | namespace clay { 8 | 9 | 10 | template 11 | To checked_cast(From* from) { 12 | // TODO: for unknown reason this code cause SEGV in runtime 13 | //assert(!from || dynamic_cast(from)); 14 | return static_cast(from); 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /compiler/codegen_op.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "clay.hpp" 5 | 6 | 7 | namespace clay { 8 | 9 | 10 | void codegenPrimOp(PrimOpPtr x, 11 | MultiCValuePtr args, 12 | CodegenContext* ctx, 13 | MultiCValuePtr out); 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /compiler/constructors.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "clay.hpp" 5 | 6 | namespace clay { 7 | 8 | bool isOverloadablePrimOp(ObjectPtr x); 9 | vector &primOpOverloads(PrimOpPtr x); 10 | vector &getPatternOverloads(); 11 | void initBuiltinConstructor(RecordDeclPtr x); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /compiler/evaluator_op.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "clay.hpp" 5 | 6 | 7 | namespace clay { 8 | 9 | 10 | void evalPrimOp(PrimOpPtr x, MultiEValuePtr args, MultiEValuePtr out); 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /compiler/lambdas.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "clay.hpp" 5 | 6 | namespace clay { 7 | 8 | void initializeLambda(LambdaPtr x, EnvPtr env); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /compiler/literals.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "clay.hpp" 5 | 6 | namespace clay { 7 | 8 | ValueHolderPtr parseIntLiteral(ModulePtr module, IntLiteral *x); 9 | ValueHolderPtr parseFloatLiteral(ModulePtr module, FloatLiteral *x); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /compiler/parachute.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace clay { 5 | 6 | int parachute(int (*mainfn)(int, char **, char const* const*), 7 | int argc, char **argv, char const* const* envp); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /compiler/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "clay.hpp" 2 | -------------------------------------------------------------------------------- /compiler/profiler.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "clay.hpp" 5 | 6 | namespace clay { 7 | void incrementCount(ObjectPtr obj); 8 | void displayCounts(); 9 | } 10 | -------------------------------------------------------------------------------- /editor-support/emacs/README.txt: -------------------------------------------------------------------------------- 1 | Steps to install clay-mode in emacs 2 | 3 | 1) Copy clay-mode.el to a directory of your choice (E.g. ~/emacs.d/clay) 4 | 5 | 2) Add the following two pieces of lines to your .emacs file - 6 | (add-to-list 'load-path "~/.emacs.d/clay/") 7 | (require 'clay-mode) 8 | -------------------------------------------------------------------------------- /editor-support/gtksourceview/clay.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Clay Source 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /editor-support/vim/ftdetect/clay.vim: -------------------------------------------------------------------------------- 1 | autocmd BufRead,BufNewFile *.clay set filetype=clay 2 | -------------------------------------------------------------------------------- /examples/cocoa/appkit/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/examples/cocoa/appkit/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /examples/hello.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | println("Hello World"); 5 | } 6 | -------------------------------------------------------------------------------- /examples/libchello.clay: -------------------------------------------------------------------------------- 1 | import libc; 2 | 3 | main() { 4 | libc.printf(cstring("Hello!\n")); 5 | } 6 | -------------------------------------------------------------------------------- /examples/win32/beep.clay: -------------------------------------------------------------------------------- 1 | import win32; 2 | 3 | main() { 4 | win32.Beep(1000u, 1000u); 5 | } 6 | -------------------------------------------------------------------------------- /lib-clay/byteorder/byteorder.clay: -------------------------------------------------------------------------------- 1 | public import byteorder.constants.*; 2 | public import byteorder.platform.*; 3 | public import byteorder.common.*; 4 | 5 | -------------------------------------------------------------------------------- /lib-clay/byteorder/constants/constants.clay: -------------------------------------------------------------------------------- 1 | enum ByteOrderKind ( 2 | UnknownByteOrder, 3 | LittleEndian, 4 | BigEndian 5 | ); 6 | -------------------------------------------------------------------------------- /lib-clay/byteorder/platform/platform.arm.clay: -------------------------------------------------------------------------------- 1 | import byteorder.constants.*; 2 | 3 | alias ByteOrder = LittleEndian; 4 | -------------------------------------------------------------------------------- /lib-clay/byteorder/platform/platform.clay: -------------------------------------------------------------------------------- 1 | import byteorder.constants.*; 2 | 3 | alias ByteOrder = UnknownByteOrder; 4 | -------------------------------------------------------------------------------- /lib-clay/byteorder/platform/platform.ppc.clay: -------------------------------------------------------------------------------- 1 | import byteorder.constants.*; 2 | 3 | alias ByteOrder = BigEndian; 4 | -------------------------------------------------------------------------------- /lib-clay/byteorder/platform/platform.sparc.clay: -------------------------------------------------------------------------------- 1 | import byteorder.constants.*; 2 | 3 | alias ByteOrder = BigEndian; 4 | -------------------------------------------------------------------------------- /lib-clay/byteorder/platform/platform.x86.clay: -------------------------------------------------------------------------------- 1 | import byteorder.constants.*; 2 | 3 | alias ByteOrder = LittleEndian; 4 | -------------------------------------------------------------------------------- /lib-clay/cocoa/appkit/appkit.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.appkit.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/appkit/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/applicationservices/applicationservices.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.applicationservices.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/applicationservices/generated/generated_from_arm.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | -------------------------------------------------------------------------------- /lib-clay/cocoa/applicationservices/generated/generated_from_x86.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/audiotoolbox/audiotoolbox.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.audiotoolbox.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/audiotoolbox/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/cocoa.macosx.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.objc.*; 2 | public import cocoa.foundation.*; 3 | public import cocoa.util.*; 4 | public import cocoa.nib.*; 5 | -------------------------------------------------------------------------------- /lib-clay/cocoa/coreaudio/coreaudio.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.coreaudio.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/coreaudio/generated/generated_from_arm.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/coreaudio/generated/generated_from_x86.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/corefoundation/corefoundation.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.corefoundation.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/corefoundation/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/coreservices/coreservices.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.coreservices.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/coreservices/generated/generated_from_arm.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/coreservices/generated/generated_from_x86.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/foundation/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/nib/nib.clay: -------------------------------------------------------------------------------- 1 | IBOutlet(forward x) = forward x; 2 | IBAction(forward x) = forward x; 3 | -------------------------------------------------------------------------------- /lib-clay/cocoa/qtkit/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/qtkit/qtkit.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.qtkit.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/quartzcore/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/quartzcore/quartzcore.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.quartzcore.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/uikit/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/uikit/uikit.clay: -------------------------------------------------------------------------------- 1 | public import cocoa.uikit.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/util/platform/platform.macosx.x86.clay: -------------------------------------------------------------------------------- 1 | import cocoa.objc.*; 2 | import cocoa.foundation.*; 3 | import cocoa.appkit.*; 4 | 5 | appKitMain(..NibClasses) { 6 | // XXX hack to force externally referenced classes to be instantiated 7 | ..for (NibClass in NibClasses) 8 | classHandle(NibClass); 9 | return NSApplicationMain(..getArgcArgv()); 10 | } 11 | -------------------------------------------------------------------------------- /lib-clay/cocoa/webkit/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/cocoa/webkit/webkit.clay: -------------------------------------------------------------------------------- 1 | 2 | public import cocoa.webkit.generated.*; 3 | -------------------------------------------------------------------------------- /lib-clay/commandline/options/options.clay: -------------------------------------------------------------------------------- 1 | 2 | public import commandline.options.spec.*; 3 | public import commandline.options.table.*; 4 | -------------------------------------------------------------------------------- /lib-clay/core/bytes/bytes.clay: -------------------------------------------------------------------------------- 1 | 2 | 3 | /// @section ByteLike? 4 | 5 | [T when Type?(T)] 6 | ByteLike?(#T) : Bool = TypeSize(T) == 1 and PODType?(T); 7 | 8 | -------------------------------------------------------------------------------- /lib-clay/core/errors/backtrace/backtrace.clay: -------------------------------------------------------------------------------- 1 | public import core.errors.backtrace.platform.( 2 | Backtrace, 3 | captureBacktrace, 4 | printBacktraceToStderr, 5 | ); 6 | 7 | // noinline because http://llvm.org/bugs/show_bug.cgi?id=13700 8 | noinline showBacktrace() : { 9 | var bt = captureBacktrace(); 10 | printBacktraceToStderr(bt); 11 | } 12 | -------------------------------------------------------------------------------- /lib-clay/core/errors/backtrace/platform/platform.clay: -------------------------------------------------------------------------------- 1 | alias BacktraceSupported? = false; 2 | 3 | record Backtrace (); 4 | 5 | forceinline captureBacktrace() : Backtrace = Backtrace(); 6 | 7 | forceinline printBacktraceToStderr(backtrace: Backtrace) : { } 8 | -------------------------------------------------------------------------------- /lib-clay/core/memory/platform/platform.clay: -------------------------------------------------------------------------------- 1 | 2 | alias SystemMallocAlignment = 8; 3 | -------------------------------------------------------------------------------- /lib-clay/core/memory/platform/platform.macosx.clay: -------------------------------------------------------------------------------- 1 | 2 | alias SystemMallocAlignment = 16; 3 | -------------------------------------------------------------------------------- /lib-clay/core/platform/cpu/cpu.arm.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(ARM); 2 | 3 | alias CPU = ARM; 4 | alias CPUFamily = ARM; 5 | 6 | alias CPUString = "arm"; 7 | alias CPUBits = 32; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/cpu/cpu.mips.32.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(MIPS32, MIPS); 2 | 3 | alias CPU = MIPS32; 4 | alias CPUFamily = MIPS; 5 | 6 | alias CPUString = "mips"; 7 | alias CPUBits = 32; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/cpu/cpu.ppc.32.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(PPC32, PPC); 2 | 3 | alias CPU = PPC32; 4 | alias CPUFamily = PPC; 5 | 6 | alias CPUString = "ppc"; 7 | alias CPUBits = 32; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/cpu/cpu.ppc.64.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(PPC64, PPC); 2 | 3 | alias CPU = PPC64; 4 | alias CPUFamily = PPC; 5 | 6 | alias CPUString = "ppc"; 7 | alias CPUBits = 64; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/cpu/cpu.x86.32.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(X86_32, X86); 2 | 3 | alias CPU = X86_32; 4 | alias CPUFamily = X86; 5 | 6 | alias CPUString = "x86"; 7 | alias CPUBits = 32; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/cpu/cpu.x86.64.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(X86_64, X86); 2 | 3 | alias CPU = X86_64; 4 | alias CPUFamily = X86; 5 | 6 | alias CPUString = "x86"; 7 | alias CPUBits = 64; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/os/os.freebsd.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(FreeBSD, Unix); 2 | 3 | alias OS = FreeBSD; 4 | alias OSFamily = Unix; 5 | 6 | alias OSString = "freebsd"; 7 | alias OSFamilyString = "unix"; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/os/os.linux.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(Linux, Unix); 2 | 3 | alias OS = Linux; 4 | alias OSFamily = Unix; 5 | 6 | alias OSString = "linux"; 7 | alias OSFamilyString = "unix"; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/os/os.macosx.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(MacOSX, Unix); 2 | 3 | alias OS = MacOSX; 4 | alias OSFamily = Unix; 5 | 6 | alias OSString = "macosx"; 7 | alias OSFamilyString = "unix"; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/os/os.windows.clay: -------------------------------------------------------------------------------- 1 | import core.platform.symbols.(Windows); 2 | 3 | alias OS = Windows; 4 | alias OSFamily = Windows; 5 | 6 | alias OSString = "windows"; 7 | alias OSFamilyString = "windows"; 8 | -------------------------------------------------------------------------------- /lib-clay/core/platform/platform.clay: -------------------------------------------------------------------------------- 1 | public import core.platform.symbols.*; 2 | public import core.platform.os.(OS, OSFamily, OSString, OSFamilyString); 3 | public import core.platform.cpu.(CPU, CPUFamily, CPUString, CPUBits); 4 | -------------------------------------------------------------------------------- /lib-clay/core/platform/symbols/symbols.clay: -------------------------------------------------------------------------------- 1 | // OSes 2 | define Linux; 3 | define MacOSX; 4 | define FreeBSD; 5 | define Windows; 6 | 7 | // OS families 8 | define Unix; 9 | 10 | // CPUs 11 | define X86_32; 12 | define X86_64; 13 | define PPC32; 14 | define PPC64; 15 | define ARM; 16 | define MIPS32; 17 | 18 | // CPU families 19 | define X86; 20 | define PPC; 21 | define MIPS; 22 | -------------------------------------------------------------------------------- /lib-clay/core/strings/stringrefs/stringrefs.clay: -------------------------------------------------------------------------------- 1 | import core.arrays.*; 2 | import core.strings.*; 3 | 4 | alias StringRef = ArrayRef[Char]; 5 | 6 | [S when ContiguousString?(S)] 7 | overload StringRef(s: S) : ArrayRef[Char] = ArrayRef(begin(s), end(s)); 8 | -------------------------------------------------------------------------------- /lib-clay/core/system/platform/platform.clay: -------------------------------------------------------------------------------- 1 | public import core.system.platform.testing.*; 2 | -------------------------------------------------------------------------------- /lib-clay/core/system/platform/testing.clay: -------------------------------------------------------------------------------- 1 | Windows?() : Bool = false; 2 | Unix?() : Bool = false; 3 | -------------------------------------------------------------------------------- /lib-clay/core/system/platform/testing.unix.clay: -------------------------------------------------------------------------------- 1 | Windows?() : Bool = false; 2 | Unix?() : Bool = true; 3 | -------------------------------------------------------------------------------- /lib-clay/core/system/platform/testing.windows.clay: -------------------------------------------------------------------------------- 1 | Windows?() : Bool = true; 2 | Unix?() : Bool = false; 3 | -------------------------------------------------------------------------------- /lib-clay/core/types/platform/platform.32.clay: -------------------------------------------------------------------------------- 1 | 2 | 3 | /// @section type aliases for 32-bit platforms 4 | 5 | alias PtrInt = Int32; 6 | alias UPtrInt = UInt32; 7 | 8 | alias CLong = Int32; 9 | alias CULong = UInt32; 10 | 11 | alias CLongDouble = Float80; 12 | alias CComplexLongDouble = Complex80; 13 | -------------------------------------------------------------------------------- /lib-clay/core/types/platform/platform.64.clay: -------------------------------------------------------------------------------- 1 | 2 | 3 | /// @section type aliases for 64-bit platforms 4 | 5 | alias PtrInt = Int64; 6 | alias UPtrInt = UInt64; 7 | 8 | alias CLong = Int64; 9 | alias CULong = UInt64; 10 | 11 | alias CLongDouble = Float80; 12 | alias CComplexLongDouble = Complex80; 13 | -------------------------------------------------------------------------------- /lib-clay/core/types/platform/platform.windows.32.clay: -------------------------------------------------------------------------------- 1 | 2 | 3 | /// @section type aliases for 32-bit platforms 4 | 5 | alias PtrInt = Int32; 6 | alias UPtrInt = UInt32; 7 | 8 | alias CLong = Int32; 9 | alias CULong = UInt32; 10 | 11 | // http://msdn.microsoft.com/en-us/library/9cx8xs15.aspx 12 | alias CLongDouble = Float64; 13 | alias CComplexLongDouble = Complex64; 14 | -------------------------------------------------------------------------------- /lib-clay/core/types/platform/platform.windows.64.clay: -------------------------------------------------------------------------------- 1 | 2 | 3 | /// @section type aliases for 64-bit platforms 4 | 5 | alias PtrInt = Int64; 6 | alias UPtrInt = UInt64; 7 | 8 | alias CLong = Int32; 9 | alias CULong = UInt32; 10 | 11 | // http://msdn.microsoft.com/en-us/library/9cx8xs15.aspx 12 | alias CLongDouble = Float64; 13 | alias CComplexLongDouble = Complex64; 14 | -------------------------------------------------------------------------------- /lib-clay/data/sequences/lazy/lazy.clay: -------------------------------------------------------------------------------- 1 | 2 | public import 3 | data.sequences.lazy.zipped.*, 4 | data.sequences.lazy.mapped.*, 5 | data.sequences.lazy.filtered.*, 6 | data.sequences.lazy.enumerated.*, 7 | data.sequences.lazy.reversed.*, 8 | data.sequences.lazy.sliced.*, 9 | data.sequences.lazy.grouped.*; 10 | -------------------------------------------------------------------------------- /lib-clay/defaultarguments/defaultarguments.clay: -------------------------------------------------------------------------------- 1 | [..T] defaultArguments(defaults, forward ..args:T) 2 | = forward ..args, ..dropValues(#countValues(..T), ..unpack(defaults)); 3 | -------------------------------------------------------------------------------- /lib-clay/expat/expat.clay: -------------------------------------------------------------------------------- 1 | public import expat.generated.*; 2 | public import expat.constants.*; 3 | -------------------------------------------------------------------------------- /lib-clay/expat/generated/Makefile: -------------------------------------------------------------------------------- 1 | generated.clay: 2 | clay-bindgen -match expat -import unix -import libc -o generated.clay generated_from.h 3 | -------------------------------------------------------------------------------- /lib-clay/expat/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/hints/hints.clay: -------------------------------------------------------------------------------- 1 | import __primitives__.(usuallyEquals); 2 | 3 | forceinline likely(x:Bool) : Bool = usuallyEquals(x, #true); 4 | 5 | forceinline unlikely(x:Bool) : Bool = usuallyEquals(x, #false); 6 | -------------------------------------------------------------------------------- /lib-clay/io/filesystem/executable/executable.clay: -------------------------------------------------------------------------------- 1 | import io.filesystem.platform.*; 2 | 3 | -------------------------------------------------------------------------------- /lib-clay/io/filesystem/executable/executable.linux.clay: -------------------------------------------------------------------------------- 1 | import io.filesystem.platform.*; 2 | 3 | pathToExecutable() = readLinkImpl(CStringRef("/proc/self/exe")); 4 | -------------------------------------------------------------------------------- /lib-clay/io/filesystem/platform/common/common.clay: -------------------------------------------------------------------------------- 1 | 2 | record DirectoryEntry ( 3 | // name is valid only before next iterator element fetched 4 | name: CStringRef, 5 | ); 6 | -------------------------------------------------------------------------------- /lib-clay/io/temp/platform/platform.unix.clay: -------------------------------------------------------------------------------- 1 | import libc; 2 | import data.strings.(String); 3 | 4 | tempDirectory() { 5 | var r = libc.getenv(cstring("TMPDIR")); 6 | if (null?(r)) { 7 | return String("/tmp"); 8 | } else { 9 | return String(r); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib-clay/io/temp/temp.clay: -------------------------------------------------------------------------------- 1 | public import io.temp.platform.(tempDirectory); 2 | 3 | -------------------------------------------------------------------------------- /lib-clay/libc/generated/generated_from_unix.h: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | -------------------------------------------------------------------------------- /lib-clay/libc/generated/generated_from_win32.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | -------------------------------------------------------------------------------- /lib-clay/libc/libc.freebsd.clay: -------------------------------------------------------------------------------- 1 | public import libc.generated.*; 2 | 3 | var stdin = __stdinp; 4 | var stdout = __stdoutp; 5 | var stderr = __stderrp; 6 | 7 | alias log2(x:Float64) = log(x)/log(2.); 8 | alias log2f(x:Float32) = logf(x)/logf(2.f); 9 | -------------------------------------------------------------------------------- /lib-clay/libc/libc.linux.clay: -------------------------------------------------------------------------------- 1 | public import libc.generated.*; 2 | 3 | -------------------------------------------------------------------------------- /lib-clay/libc/libc.macosx.clay: -------------------------------------------------------------------------------- 1 | public import libc.generated.*; 2 | 3 | var stdin = __stdinp; 4 | var stdout = __stdoutp; 5 | var stderr = __stderrp; 6 | 7 | // these are macros in libc 8 | 9 | forceinline isnan(x:Double) : Int = Int(x != x); 10 | forceinline isnanf(x:Float) : Int = Int(x != x); 11 | forceinline isnanl(x:LongDouble) : Int = Int(x != x); 12 | -------------------------------------------------------------------------------- /lib-clay/llvm/libclang/generated/Makefile: -------------------------------------------------------------------------------- 1 | generated.clay: generated_from.h 2 | clay-bindgen -o generated.clay \ 3 | -import libc \ 4 | -match Index.h \ 5 | generated_from.h 6 | -------------------------------------------------------------------------------- /lib-clay/llvm/libclang/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /lib-clay/llvm/libclang/libclang.clay: -------------------------------------------------------------------------------- 1 | public import llvm.libclang.generated.*; 2 | -------------------------------------------------------------------------------- /lib-clay/math/math.clay: -------------------------------------------------------------------------------- 1 | // public import math.libm.*; 2 | public import math.native.*; 3 | -------------------------------------------------------------------------------- /lib-clay/math/native/abscomplex.clay: -------------------------------------------------------------------------------- 1 | public import math.native.protocol.*; 2 | 3 | [U when Complex?(U) ] 4 | forceinline overload abs(x:U) = hypot(real(x),imagValue(x)); 5 | 6 | -------------------------------------------------------------------------------- /lib-clay/math/native/arg.clay: -------------------------------------------------------------------------------- 1 | 2 | import math.native.protocol.*; 3 | 4 | [T when Complex?(T) ] 5 | arg(x:T) = atan2(imagValue(x),real(x)); 6 | -------------------------------------------------------------------------------- /lib-clay/math/native/beta.clay: -------------------------------------------------------------------------------- 1 | import math.native.protocol.*; 2 | import complex.*; 3 | 4 | [T,U when (Float?(T,U) or Complex?(T,U)) ] 5 | forceinline beta(x:T, y:U) = exp(lgamma(x)+lgamma(y)-lgamma(x+y)); 6 | -------------------------------------------------------------------------------- /lib-clay/math/native/ldexp.clay: -------------------------------------------------------------------------------- 1 | import math.native.protocol.*; 2 | import numbers.floats.(finite?); 3 | 4 | [T,I when Float?(T) and Integer?(I)] 5 | overload ldexp(value:T, i:I) 6 | = if(not finite?(value) or value==0.) value else scalbn(value,i); 7 | -------------------------------------------------------------------------------- /lib-clay/math/native/proj.clay: -------------------------------------------------------------------------------- 1 | 2 | import complex.*; 3 | import numbers.floats.(infinity?,infinity); 4 | import math.native.protocol.*; 5 | 6 | 7 | [T when Complex?(T) ] 8 | proj(z:T) { 9 | 10 | if (not infinity?(real(z)) and not infinity?(imagValue(z))) 11 | return z; 12 | else 13 | return Complex(infinity(ComplexBaseType(T)), copysign(0.0, imagValue(z))); 14 | } 15 | -------------------------------------------------------------------------------- /lib-clay/numbers/parser/errno/errno.unix.clay: -------------------------------------------------------------------------------- 1 | public import unix.(errno, ERANGE); 2 | -------------------------------------------------------------------------------- /lib-clay/numbers/parser/errno/errno.windows.clay: -------------------------------------------------------------------------------- 1 | public import win32.errno.(errno, ERANGE); 2 | -------------------------------------------------------------------------------- /lib-clay/opengl/lookup/lookup.clay: -------------------------------------------------------------------------------- 1 | import opengl.platform.*; 2 | 3 | findGLFunction(Args, Return, ..names) { 4 | ..for (name in names) { 5 | var ptr = lookupGLFunction(name); 6 | if (not null?(ptr)) 7 | return GLCodePointer[Args, Return](ptr); 8 | } 9 | return GLCodePointer[Args, Return](0); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /lib-clay/opengl/platform/platform.macosx.clay: -------------------------------------------------------------------------------- 1 | alias GLAPI = cdecl; 2 | 3 | alias GLCodePointer[Args, Return] = CCodePointer[Args, Return]; 4 | 5 | external dlsym(module : RawPointer, name : Pointer[CChar]) : RawPointer; 6 | alias RTLD_DEFAULT = RawPointer(-2); 7 | 8 | lookupGLFunction(name) = GLCodePointer[[], []](dlsym(RTLD_DEFAULT, cstring(name))); 9 | -------------------------------------------------------------------------------- /lib-clay/opengl/platform/platform.unix.clay: -------------------------------------------------------------------------------- 1 | alias GLCodePointer[Args, Return] = CCodePointer[Args, Return]; 2 | alias GLAPI = cdecl; 3 | 4 | external glXGetProcAddress(name: Pointer[CChar]) : GLCodePointer[[], []]; 5 | 6 | lookupGLFunction(name) = glXGetProcAddress(cstring(name)); 7 | -------------------------------------------------------------------------------- /lib-clay/opengl/platform/platform.windows.clay: -------------------------------------------------------------------------------- 1 | import win32.(WINAPI, WinApiCodePointer); 2 | 3 | alias GLCodePointer[Args, Return] = WinApiCodePointer[Args, Return]; 4 | alias GLAPI = WINAPI; 5 | 6 | external (WINAPI) wglGetProcAddress(name: LPCSTR) : GLCodePointer[[], []]; 7 | 8 | lookupGLFunction(name) = wglGetProcAddress(cstring(name)); 9 | -------------------------------------------------------------------------------- /lib-clay/os/errors/platform/platform.unix.clay: -------------------------------------------------------------------------------- 1 | 2 | import unix; 3 | 4 | printErrorMessageTo(stream, code:Int) { 5 | unix.printErrorMessageTo(stream, code); 6 | } 7 | 8 | errorCodeName(code:Int) { 9 | return unix.errnoName(code); 10 | } 11 | -------------------------------------------------------------------------------- /lib-clay/os/errors/platform/platform.windows.clay: -------------------------------------------------------------------------------- 1 | 2 | import win32; 3 | import win32.printer as printer; 4 | 5 | printErrorMessageTo(stream, code:Int) { 6 | printer.printErrorMessageTo(stream, code); 7 | } 8 | 9 | errorCodeName(code:Int) { 10 | return win32.errorCodeName(code); 11 | } 12 | -------------------------------------------------------------------------------- /lib-clay/prelude/prelude.clay: -------------------------------------------------------------------------------- 1 | public import core.*; 2 | 3 | 4 | 5 | // include self so that even if any symbol is shadowed 6 | // it can still be accessed as 'prelude.XXX'. 7 | public import prelude; 8 | 9 | -------------------------------------------------------------------------------- /lib-clay/prelude/repl/repl.clay: -------------------------------------------------------------------------------- 1 | public import prelude.*; 2 | public import printer.*; 3 | -------------------------------------------------------------------------------- /lib-clay/printer/exceptions/exceptions.clay: -------------------------------------------------------------------------------- 1 | import printer.protocol.*; 2 | import io.files.raw.(stderrRawFile); 3 | 4 | 5 | /// @section printUnhandledExceptionToStderr 6 | 7 | // simple version that uses default printTo of exception 8 | overload printUnhandledExceptionToStderr(e) { 9 | printTo(stderrRawFile(), str("unhandled exception: ", e, "\n")); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /lib-clay/printer/platform/platform.clay: -------------------------------------------------------------------------------- 1 | 2 | alias formatForInt64 = "%lld"; 3 | alias formatForUInt64 = "%llu"; 4 | alias formatForHexInt64 = "%llx"; 5 | alias formatForHEXInt64 = "%llX"; 6 | alias formatForOctInt64 = "%llo"; 7 | 8 | alias formatForPartialInt128 = "%018llu"; 9 | -------------------------------------------------------------------------------- /lib-clay/printer/platform/platform.windows.clay: -------------------------------------------------------------------------------- 1 | 2 | alias formatForInt64 = "%I64d"; 3 | alias formatForUInt64 = "%I64u"; 4 | alias formatForHexInt64 = "%I64x"; 5 | alias formatForHEXInt64 = "%I64X"; 6 | alias formatForOctInt64 = "%I64o"; 7 | 8 | alias formatForPartialInt128 = "%018I64u"; 9 | -------------------------------------------------------------------------------- /lib-clay/printer/protocol/protocol.clay: -------------------------------------------------------------------------------- 1 | define printTo; 2 | define printReprTo; 3 | define str; 4 | -------------------------------------------------------------------------------- /lib-clay/threads/locks/protocol/protocol.clay: -------------------------------------------------------------------------------- 1 | define lock(l) :; 2 | define unlock(l) :; // cannot throw 3 | define tryLock(l) : Bool; 4 | 5 | Lock?(L) = CallDefined?(lock, L) 6 | and CallDefined?(unlock, L) 7 | and CallDefined?(tryLock, L); 8 | -------------------------------------------------------------------------------- /lib-clay/threads/threads.clay: -------------------------------------------------------------------------------- 1 | public import threads.core.*; 2 | public import threads.future.*; 3 | -------------------------------------------------------------------------------- /lib-clay/time/platform/platform.windows.clay: -------------------------------------------------------------------------------- 1 | 2 | import win32; 3 | 4 | sleep(seconds:Double) { 5 | var mseconds = CULong(seconds * 1000); 6 | win32.Sleep(mseconds); 7 | } 8 | -------------------------------------------------------------------------------- /lib-clay/win32/generated/Makefile: -------------------------------------------------------------------------------- 1 | 2 | default : 3 | @echo "use 'make windows32' or 'make windows64'." 4 | 5 | windows32 : 6 | clay-bindgen generated_from.h -o generated.windows.32.clay 7 | 8 | windows64 : 9 | clay-bindgen generated_from.h -o generated.windows.64.clay 10 | -------------------------------------------------------------------------------- /lib-clay/win32/generated/generated_from.h: -------------------------------------------------------------------------------- 1 | #define WIN32_LEAN_AND_MEAN 2 | #include 3 | #include 4 | -------------------------------------------------------------------------------- /lib-clay/win32/platform/platform.windows.32.clay: -------------------------------------------------------------------------------- 1 | 2 | alias WINAPI = stdcall; 3 | alias WinApiCodePointer = StdCallCodePointer; 4 | -------------------------------------------------------------------------------- /lib-clay/win32/platform/platform.windows.64.clay: -------------------------------------------------------------------------------- 1 | 2 | alias WINAPI = cdecl; 3 | alias WinApiCodePointer = CCodePointer; 4 | -------------------------------------------------------------------------------- /misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 2 | add_subdirectory(Xcode) 3 | endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 4 | -------------------------------------------------------------------------------- /misc/Xcode/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(PROGRAMS clay-xcodebuild DESTINATION bin) 2 | -------------------------------------------------------------------------------- /misc/Xcode/Project Templates/Clay/Cocoa Application/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /misc/Xcode/Project Templates/Clay/Cocoa Application/___PROJECTNAMEASIDENTIFIER___/appdelegate.clay: -------------------------------------------------------------------------------- 1 | import cocoa.*; 2 | import cocoa.appkit.*; 3 | 4 | record AppDelegate = newClass("___PROJECTNAMEASIDENTIFIER___AppDelegate", NSObject, 5 | InstanceVars( 6 | ["window", IBOutlet(NSWindow)], 7 | ), 8 | ClassMethods(), 9 | InstanceMethods(), 10 | ); 11 | -------------------------------------------------------------------------------- /misc/Xcode/Project Templates/Clay/Cocoa Application/main.clay: -------------------------------------------------------------------------------- 1 | import cocoa.*; 2 | import ___PROJECTNAMEASIDENTIFIER___.appdelegate.*; 3 | 4 | main() = appKitMain(AppDelegate); -------------------------------------------------------------------------------- /misc/Xcode/Project Templates/Clay/Cocoa Touch Application for iPad/___PROJECTNAMEASIDENTIFIER___/viewcontroller.clay: -------------------------------------------------------------------------------- 1 | import cocoa.*; 2 | import cocoa.uikit.*; 3 | 4 | record ViewController = newClass("___PROJECTNAMEASIDENTIFIER___ViewController", UIViewController, 5 | InstanceVars(), 6 | ClassMethods(), 7 | InstanceMethods(), 8 | ); -------------------------------------------------------------------------------- /misc/Xcode/Project Templates/Clay/Cocoa Touch Application for iPad/main.clay: -------------------------------------------------------------------------------- 1 | import cocoa.*; 2 | import ___PROJECTNAMEASIDENTIFIER___.appdelegate.*; 3 | import ___PROJECTNAMEASIDENTIFIER___.viewcontroller.*; 4 | 5 | main() = uiKitMain(AppDelegate, ViewController); -------------------------------------------------------------------------------- /misc/Xcode/Project Templates/Clay/Cocoa Touch Application for iPhone/___PROJECTNAMEASIDENTIFIER___/viewcontroller.clay: -------------------------------------------------------------------------------- 1 | import cocoa.*; 2 | import cocoa.uikit.*; 3 | 4 | record ViewController = newClass("___PROJECTNAMEASIDENTIFIER___ViewController", UIViewController, 5 | InstanceVars(), 6 | ClassMethods(), 7 | InstanceMethods(), 8 | ); -------------------------------------------------------------------------------- /misc/Xcode/Project Templates/Clay/Cocoa Touch Application for iPhone/main.clay: -------------------------------------------------------------------------------- 1 | import cocoa.*; 2 | import ___PROJECTNAMEASIDENTIFIER___.appdelegate.*; 3 | import ___PROJECTNAMEASIDENTIFIER___.viewcontroller.*; 4 | 5 | main() = uiKitMain(AppDelegate, ViewController); -------------------------------------------------------------------------------- /misc/Xcode/objc-export/clay-objc-export: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ $# -ne 1 ]; then 4 | echo "Usage: $0 path/to/main.clay" 5 | echo "main.clay must use appKitMain or uiKitMain" 6 | exit 2 7 | fi 8 | 9 | SELFDIR=`dirname $0` 10 | clay -I$SELFDIR -run "$1" 11 | -------------------------------------------------------------------------------- /misc/Xcode/objc-export/cocoa/nib/nib.clay: -------------------------------------------------------------------------------- 1 | // monkey-patch IBOutlet and IBAction so they're visible 2 | record IBOutletWrapper[T] (x: T); 3 | record IBActionWrapper[T] (x: T); 4 | 5 | IBOutlet(T) = IBOutletWrapper[T]; 6 | IBAction(T) = IBActionWrapper; 7 | -------------------------------------------------------------------------------- /misc/clay-pigeon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/misc/clay-pigeon.png -------------------------------------------------------------------------------- /test/example/claydoc/main.clay: -------------------------------------------------------------------------------- 1 | /** @section dig this 2 | ** a function to test docs 3 | */ 4 | function (x, y) { return x * y; } 5 | 6 | /// 7 | /// @section in tha haus 8 | /// this is main 9 | 10 | main(){} 11 | 12 | -------------------------------------------------------------------------------- /test/example/claydoc/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/example/claydoc/out.txt -------------------------------------------------------------------------------- /test/example/dll/testdll.clay: -------------------------------------------------------------------------------- 1 | 2 | external sayHello() { 3 | println("Hello World"); 4 | } 5 | 6 | external factorial(n:Int) Int { 7 | var p = 1; 8 | for (i in range(2,n+1)) 9 | p *: i; 10 | return p; 11 | } 12 | -------------------------------------------------------------------------------- /test/example/dll/testdllclient.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | external sayHello(); 4 | 5 | external factorial(n:Int) Int; 6 | 7 | main() { 8 | sayHello(); 9 | println("factorial(5) = ", factorial(5)); 10 | } 11 | -------------------------------------------------------------------------------- /test/example/helloworld/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | println("Hello World"); 5 | } 6 | -------------------------------------------------------------------------------- /test/example/helloworld/out.txt: -------------------------------------------------------------------------------- 1 | Hello World 2 | -------------------------------------------------------------------------------- /test/example/namedunions/out.txt: -------------------------------------------------------------------------------- 1 | 255 2 | -------------------------------------------------------------------------------- /test/example/permissive/out.txt: -------------------------------------------------------------------------------- 1 | 1, 2, true 2 | -------------------------------------------------------------------------------- /test/example/shootout/insertionsort1/out.txt: -------------------------------------------------------------------------------- 1 | a[0] = 1998 2 | -------------------------------------------------------------------------------- /test/example/shootout/insertionsort2/out.txt: -------------------------------------------------------------------------------- 1 | a[0] = 1998 2 | -------------------------------------------------------------------------------- /test/example/shootout/mean/main.clay: -------------------------------------------------------------------------------- 1 | 2 | test() { 3 | var result = 0.; 4 | for (i in range(100000)) { 5 | result = 0.; 6 | for (j in range(10000)) 7 | result +: Float64(j); 8 | } 9 | result /: 10000.; 10 | return result; 11 | } 12 | 13 | main() { 14 | return Int(test()); 15 | } 16 | -------------------------------------------------------------------------------- /test/example/shootout/mean/mean.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func test() float { 4 | var result float; 5 | for i := 0; i < 100000; i++ { 6 | result = 0 7 | for j := 0; j < 10000; j++ { 8 | result += float(j); 9 | } 10 | } 11 | result = result / 10000; 12 | return result; 13 | } 14 | 15 | func main() { 16 | test(); 17 | } 18 | -------------------------------------------------------------------------------- /test/example/shootout/mean/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/example/shootout/mean/out.txt -------------------------------------------------------------------------------- /test/example/shootout/quicksort1/out.txt: -------------------------------------------------------------------------------- 1 | a[0] = 1998 2 | -------------------------------------------------------------------------------- /test/example/shootout/quicksort2/out.txt: -------------------------------------------------------------------------------- 1 | a[0] = 1998 2 | -------------------------------------------------------------------------------- /test/lang/array/test.clay: -------------------------------------------------------------------------------- 1 | import test.*; 2 | 3 | main() = testMain(TestSuite("arrays", array( 4 | TestCase("constant of type Array", -> { 5 | expectEqual(array(17, 19), unwrapStatic(#array(17, 19))); 6 | }), 7 | ))); 8 | -------------------------------------------------------------------------------- /test/lang/as/asArguments/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | [T when Integer?(T)] 4 | foo(x:T as Int64, y as Float64) = T, Type(x), Type(y); 5 | 6 | main() { 7 | var a = 2; 8 | ref ra = a; 9 | println(..weaveValues(",", ..foo(a, 7.f))); 10 | println(..weaveValues(",", ..foo(ra, 9.0))); 11 | } -------------------------------------------------------------------------------- /test/lang/as/asArguments/out.txt: -------------------------------------------------------------------------------- 1 | Int32,Int64,Float64 2 | Int32,Int64,Float64 3 | -------------------------------------------------------------------------------- /test/lang/atomic/primitives/out.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | 4 4 | 4 5 | 17 6 | 17 17 7 | -------------------------------------------------------------------------------- /test/lang/bindings/ref/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | ref can only bind to an lvalue 2 | -------------------------------------------------------------------------------- /test/lang/bindings/ref/1/main.clay: -------------------------------------------------------------------------------- 1 | foo(forward ..args) --> returned:Char { 2 | ref value = nthValue(#1, ..args); 3 | } 4 | 5 | main() { 6 | foo(1, "2"); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/bindings/variadic/out.txt: -------------------------------------------------------------------------------- 1 | 189, 5, 6.8000002, 7 2 | 5, 4, 5, 6.8000002, 7 3 | UInt64, Float64, UInt32, Float32, Int16 4 | UInt64, Float64, UInt32, Float32, Int16 5 | 0, 8, 9 6 | 1, 2, 3, 4, 5, 6, 7 7 | Int32, Int32, Int32, Int32, Int32, Int32, Int32 8 | 9 | 0, 1 10 | -------------------------------------------------------------------------------- /test/lang/builtins/union/test.clay: -------------------------------------------------------------------------------- 1 | import test.*; 2 | 3 | main() = testMain( 4 | TestSuite( 5 | "__operators__ union", array( 6 | TestCase("UnionMemberCount", -> { 7 | expectEqual(2, UnionMemberCount(Union[Int, Bool])); 8 | }), 9 | ), 10 | ) 11 | ); 12 | -------------------------------------------------------------------------------- /test/lang/callbyname/arg/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | alias show(x) { 4 | println(__ARG__ x, " = ", x); 5 | } 6 | 7 | main() { 8 | var a, b = 3, 4; 9 | show(2); 10 | show(2 + 2); 11 | show(add(2, 2)); 12 | show(a + b); 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/callbyname/arg/out.txt: -------------------------------------------------------------------------------- 1 | 2 = 2 2 | 2 + 2 = 4 3 | add(2, 2) = 4 4 | a + b = 7 5 | -------------------------------------------------------------------------------- /test/lang/callbyname/arg/variadic/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | alias foo(..x) = __ARG__ x; 4 | 5 | main() { 6 | var ..abc = 'a', 'b', 'c'; 7 | println(foo(1, 2, 3)); 8 | println(foo(..abc)); 9 | println(foo(..abc, 'd')); 10 | } 11 | -------------------------------------------------------------------------------- /test/lang/callbyname/arg/variadic/out.txt: -------------------------------------------------------------------------------- 1 | 1, 2, 3 2 | ..abc 3 | ..abc, 'd' 4 | -------------------------------------------------------------------------------- /test/lang/callbyname/fileLineColumn/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | alias sayMyLocation() { 4 | println("(", __LINE__, ",", __COLUMN__, ")"); 5 | } 6 | main() { 7 | sayMyLocation(); 8 | sayMyLocation(); 9 | sayMyLocation(); 10 | } 11 | -------------------------------------------------------------------------------- /test/lang/callbyname/fileLineColumn/out.txt: -------------------------------------------------------------------------------- 1 | (7,4) 2 | (8,5) 3 | (9,6) 4 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/cross/compilererr.txt: -------------------------------------------------------------------------------- 1 | alias functions stack overflow 2 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/cross/main.clay: -------------------------------------------------------------------------------- 1 | alias yy() { 2 | xx(); 3 | } 4 | 5 | alias xx() { 6 | yy(); 7 | } 8 | 9 | main() { 10 | xx(); 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/does-not-count/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | fact(n: Int): Int = 4 | if (n > 1) n * useless(n - 1) 5 | else 1; 6 | 7 | alias useless(n) = fact(n); 8 | 9 | main() { 10 | println(fact(10)); 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/does-not-count/out.txt: -------------------------------------------------------------------------------- 1 | 3628800 2 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/param-self/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | alias zzz(param) = param; 4 | 5 | main() { 6 | println(zzz(zzz(2))); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/param-self/out.txt: -------------------------------------------------------------------------------- 1 | 2 2 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/simple/compilererr.txt: -------------------------------------------------------------------------------- 1 | alias functions stack overflow 2 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/simple/main.clay: -------------------------------------------------------------------------------- 1 | alias xx() { 2 | xx(); 3 | } 4 | 5 | main() { 6 | xx(); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/two-in-one/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | alias yy() { 4 | println("yy"); 5 | } 6 | 7 | alias xx() { 8 | yy(); 9 | yy(); 10 | } 11 | 12 | main() { 13 | xx(); 14 | } 15 | -------------------------------------------------------------------------------- /test/lang/callbyname/recursive/two-in-one/out.txt: -------------------------------------------------------------------------------- 1 | yy 2 | yy 3 | -------------------------------------------------------------------------------- /test/lang/callbyname/singleAliasArgUnpackExpr/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | alias foo(x) { 4 | println(__ARG__ x, ": ", x); 5 | } 6 | 7 | bar(forward ..x) { 8 | foo(..x); 9 | } 10 | 11 | main() { 12 | bar("hello world"); 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/callbyname/singleAliasArgUnpackExpr/out.txt: -------------------------------------------------------------------------------- 1 | ..x: hello world 2 | -------------------------------------------------------------------------------- /test/lang/codepointers/1/out.txt: -------------------------------------------------------------------------------- 1 | CodePointer[[Vector[Int32], Int32], [ByRef[Int32]]] 2 | CodePointer[[Vector[Int32]], []] 3 | CodePointer[[Int32, Bool], [Int32]] 4 | CodePointer[[], []] 5 | CodePointer[[Int32, Bool], [Bool, Int32]] 6 | -------------------------------------------------------------------------------- /test/lang/codepointers/2/out.txt: -------------------------------------------------------------------------------- 1 | ExternalCodePointer[AttributeCCall, true, [Pointer[Int8]], [Int32]] 2 | 3 | VarArgsCCodePointer 4 | In = Pointer[Int8] 5 | Out = Int32 6 | 7 | CCodePointer 8 | In = Pointer[Int8]Pointer[Int8] 9 | Out = Pointer[Int8] 10 | -------------------------------------------------------------------------------- /test/lang/codepointers/3/out.txt: -------------------------------------------------------------------------------- 1 | hello, world! x = 10 -------------------------------------------------------------------------------- /test/lang/codepointers/30/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 3.2 3 | Hi! 4 | -------------------------------------------------------------------------------- /test/lang/codepointers/31/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 3.2 3 | Hi! 4 | -------------------------------------------------------------------------------- /test/lang/codepointers/32/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 3.2 3 | Hi! 4 | [1, 3.2, Hi!] 5 | [1, 3.2, Hi!, [1, 3.2, Hi!]] 6 | [1, 3.2, Hi!, [1, 3.2, Hi!], [1, 3.2, Hi!, [1, 3.2, Hi!]]] 7 | -------------------------------------------------------------------------------- /test/lang/computedrecords/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | computeFields(T) { 4 | return x:T, y:T; 5 | } 6 | 7 | record Point[T] = ..computeFields(T); 8 | 9 | // the above definition is equivalent to: 10 | // record Point[T] ( 11 | // x : T, 12 | // y : T, 13 | // ); 14 | 15 | main() { 16 | var p = Point[Int](10, 10); 17 | println(p); 18 | } 19 | -------------------------------------------------------------------------------- /test/lang/computedrecords/1/out.txt: -------------------------------------------------------------------------------- 1 | Point[Int32](10, 10) 2 | -------------------------------------------------------------------------------- /test/lang/computedrecords/2/out.txt: -------------------------------------------------------------------------------- 1 | Vectorized[Point]({1, 2, 3}, {4, 5, 6}) 2 | -------------------------------------------------------------------------------- /test/lang/computedrecords/custompredicate/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | Point[Int32](10, 20) 3 | Point[Int32](1, 3) 4 | Point[Int32](97, 122) 5 | -------------------------------------------------------------------------------- /test/lang/computedrecords/customproperty/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | -1 3 | false 4 | true 5 | 2 6 | [[x, Int32], [y, Int32]] 7 | -------------------------------------------------------------------------------- /test/lang/destructors/main.clay: -------------------------------------------------------------------------------- 1 | import destructors.*; 2 | import printer.(println); 3 | 4 | var destroyed = false; 5 | 6 | destroyThingy(x) { println("destroying ", x); destroyed = true; } 7 | 8 | scope() { 9 | var y = destroyedBy(5, destroyThingy); 10 | } 11 | 12 | main() { 13 | scope(); 14 | println("destroyed? ", destroyed); 15 | } 16 | -------------------------------------------------------------------------------- /test/lang/destructors/out.txt: -------------------------------------------------------------------------------- 1 | destroying 5 2 | destroyed? true 3 | -------------------------------------------------------------------------------- /test/lang/dispatch/out.txt: -------------------------------------------------------------------------------- 1 | zero 2 | one 3 | two 4 | -------------------------------------------------------------------------------- /test/lang/enums/predicates/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/enums/predicates/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | private Ok?() = true; 4 | 5 | [when Ok?()] 6 | enum Touchable (FOO); 7 | 8 | [when false] 9 | enum Untouchable (BAR); 10 | 11 | main() { 12 | println(FOO); 13 | println(BAR); 14 | } 15 | -------------------------------------------------------------------------------- /test/lang/enums/predicates/out.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/evaluator/1/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/evaluator/1/out.txt -------------------------------------------------------------------------------- /test/lang/evaluator/issue319/out.txt: -------------------------------------------------------------------------------- 1 | Aaa 2 | Bbb 3 | Eee(-1) 4 | Eee(2) 5 | true 6 | true 7 | false 8 | 2 9 | 1 10 | -------------------------------------------------------------------------------- /test/lang/exceptions/1/out.txt: -------------------------------------------------------------------------------- 1 | Created 1 2 | Destroyed 1 3 | Caught! 4 | -------------------------------------------------------------------------------- /test/lang/exceptions/2/out.txt: -------------------------------------------------------------------------------- 1 | Hello World 2 | Destroyed 2 3 | Destroyed 1 4 | Destroyed 3 5 | Destroyed 1 6 | Caught. Throwing again. 7 | Destroyed 20 8 | Caught 9 | -------------------------------------------------------------------------------- /test/lang/exceptions/3/out.txt: -------------------------------------------------------------------------------- 1 | Destroyed 1 2 | Caught 3 | -------------------------------------------------------------------------------- /test/lang/exceptions/arrays/out.txt: -------------------------------------------------------------------------------- 1 | testing array construction 2 | caught exception: CanaryError() 3 | testing array copy 4 | caught exception: CanaryError() 5 | testing array move 6 | testing array destroy/reset 7 | -------------------------------------------------------------------------------- /test/lang/exceptions/catch/context/out.txt: -------------------------------------------------------------------------------- 1 | foo: 9 2 | bar: 17 3 | -------------------------------------------------------------------------------- /test/lang/exceptions/catch/simple/out.txt: -------------------------------------------------------------------------------- 1 | caught Int32 exception 0 2 | caught unexpected exception 3 | caught OtherException exception 4 | -------------------------------------------------------------------------------- /test/lang/exceptions/custom/out.txt: -------------------------------------------------------------------------------- 1 | Error1(negative) 2 | error code = 0 3 | Error2(positive) 4 | exception: Error1(negative) 5 | exception: 0 6 | exception: Error2(positive) 7 | -------------------------------------------------------------------------------- /test/lang/exceptions/finally/goto/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | println("a"); 5 | { 6 | finally println("c"); 7 | println("b"); 8 | if (true) 9 | goto d; 10 | println("x"); 11 | } 12 | println("y"); 13 | d: 14 | println("d"); 15 | } 16 | -------------------------------------------------------------------------------- /test/lang/exceptions/finally/goto/out.txt: -------------------------------------------------------------------------------- 1 | a 2 | b 3 | c 4 | d 5 | -------------------------------------------------------------------------------- /test/lang/exceptions/finally/out.txt: -------------------------------------------------------------------------------- 1 | --> foo 2 | lalala 3 | <-- foo 4 | --> foo 5 | lalala 6 | <-- foo 7 | caught 17 8 | --> bar 9 | lalala 10 | <-- abcdef 11 | --> bar 12 | lalala 13 | <-- abcghi 14 | caught 42 15 | --> bas 16 | lalala 17 | <-- a 18 | --> bas 19 | lalala 20 | <-- aa 21 | caught 86 22 | -------------------------------------------------------------------------------- /test/lang/exceptions/lambdas/out.txt: -------------------------------------------------------------------------------- 1 | caught 451 2 | tried 1 times; caught 1 exceptions 3 | -------------------------------------------------------------------------------- /test/lang/exceptions/onerror/out.txt: -------------------------------------------------------------------------------- 1 | --> foo 2 | lalala 3 | <-- exited 4 | --> foo 5 | lalala 6 | <-- threw 7 | caught 17 8 | --> bar 9 | lalala 10 | <-- exited, s = abcdef 11 | --> bar 12 | lalala 13 | <-- threw, s = abcghi 14 | caught 42 15 | --> bas 16 | lalala 17 | <-- exited, s = a 18 | --> bas 19 | lalala 20 | <-- threw, s = aa 21 | caught 86 22 | -------------------------------------------------------------------------------- /test/lang/exceptions/rethrow/any/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | foo() { 4 | throw GenericException("from foo"); 5 | } 6 | 7 | bar() { 8 | try { 9 | foo(); 10 | } catch (e) { 11 | throw; 12 | } 13 | } 14 | 15 | main() { 16 | try { 17 | bar(); 18 | } catch (e: GenericException) { 19 | println("caught ", e); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/lang/exceptions/rethrow/any/out.txt: -------------------------------------------------------------------------------- 1 | caught GenericException(from foo) 2 | -------------------------------------------------------------------------------- /test/lang/exceptions/rethrow/concrete/out.txt: -------------------------------------------------------------------------------- 1 | caught GenericException(from foo) 2 | -------------------------------------------------------------------------------- /test/lang/exceptions/rethrow/outside-catch/compilererr.txt: -------------------------------------------------------------------------------- 1 | rethrow statement can be used only from within catch block 2 | -------------------------------------------------------------------------------- /test/lang/exceptions/rethrow/outside-catch/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | throw; 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/after-rethrow/err.txt: -------------------------------------------------------------------------------- 1 | (re) 2 | unhandled MyException exception.*at.*main.clay:6 3 | -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/after-rethrow/main.clay: -------------------------------------------------------------------------------- 1 | record MyException(a: Int); 2 | 3 | instance Exception (MyException); 4 | 5 | foo() { 6 | throw MyException(17); 7 | } 8 | 9 | main() { 10 | try { 11 | foo(); 12 | } catch (e) { 13 | throw; // ctx.line must be 6 after this statement 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/after-rethrow/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/exceptions/unhandled/after-rethrow/out.txt -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/core/err.txt: -------------------------------------------------------------------------------- 1 | (re) 2 | unhandled MyException exception.*at.*main.clay:6 3 | -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/core/main.clay: -------------------------------------------------------------------------------- 1 | record MyException(a: Int); 2 | 3 | instance Exception (MyException); 4 | 5 | main() { 6 | throw MyException(17); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/core/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/exceptions/unhandled/core/out.txt -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/printer/err.txt: -------------------------------------------------------------------------------- 1 | (re) 2 | unhandled exception: MyException\(17\).*at .*main.clay:8 3 | -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/printer/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | record MyException(a: Int); 4 | 5 | instance Exception (MyException); 6 | 7 | main() { 8 | throw MyException(17); 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/exceptions/unhandled/printer/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/exceptions/unhandled/printer/out.txt -------------------------------------------------------------------------------- /test/lang/expr/eval/main.clay: -------------------------------------------------------------------------------- 1 | import printer.formatter.(repr); 2 | import printer.(println); 3 | 4 | main() { 5 | var x, y, z1, z2 = eval "123", eval ("456", "us"), ..eval "789, 1011"; 6 | 7 | println(repr(x)); 8 | println(repr(y)); 9 | println(repr(z1)); 10 | println(repr(z2)); 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/expr/eval/out.txt: -------------------------------------------------------------------------------- 1 | 123i 2 | 456us 3 | 789i 4 | 1011i 5 | -------------------------------------------------------------------------------- /test/lang/expr/if/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main() { 3 | var x = 100; 4 | 5 | if (x +: 1; inc(x); var x = 200; x +: 1; inc(x); x == 202) { 6 | println(x); 7 | } 8 | println(x); 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/expr/if/1/out.txt: -------------------------------------------------------------------------------- 1 | 202 2 | 102 3 | -------------------------------------------------------------------------------- /test/lang/expr/if/2/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/expr/if/3/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | oddOrEven(n) { 4 | println(if (n % 2 == 0) "even" else "odd"); 5 | } 6 | 7 | main() { 8 | for (i in range(5)) 9 | oddOrEven(i); 10 | } 11 | -------------------------------------------------------------------------------- /test/lang/expr/if/3/out.txt: -------------------------------------------------------------------------------- 1 | even 2 | odd 3 | even 4 | odd 5 | even 6 | -------------------------------------------------------------------------------- /test/lang/expr/switch/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main() { 3 | var x = 100; 4 | switch (x +: 1; inc(x); var x = 200; x +: 1; inc(x); x) 5 | case (202) 6 | println("inner ", x); 7 | else 8 | println("oops ", x); 9 | 10 | println("outer ", x); 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/expr/switch/1/out.txt: -------------------------------------------------------------------------------- 1 | inner 202 2 | outer 102 3 | -------------------------------------------------------------------------------- /test/lang/expr/while/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main() { 3 | var x, y = 100, 200; 4 | while (x +: 1; inc(y); var x = 300; x +: 1; inc(x); y < 205) 5 | println("inner x = ", x, " y = ", y); 6 | 7 | println("outer x = ", x, " y = ", y); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/expr/while/1/out.txt: -------------------------------------------------------------------------------- 1 | inner x = 302 y = 201 2 | inner x = 302 y = 202 3 | inner x = 302 y = 203 4 | inner x = 302 y = 204 5 | outer x = 105 y = 205 6 | -------------------------------------------------------------------------------- /test/lang/expr/while/2/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/externalmain/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | import data.algorithms.*; 3 | 4 | external main(argc: Int, argv: Pointer[Pointer[CChar]]) : Int { 5 | println("hello world"); 6 | println(argc); 7 | var argv0 = CStringRef(argv[0]); 8 | //println(argv0); 9 | println(in?(argv0, "main") or in?(argv0, "test")); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/externalmain/out.txt: -------------------------------------------------------------------------------- 1 | hello world 2 | 1 3 | true 4 | -------------------------------------------------------------------------------- /test/lang/flags/buildflags.txt: -------------------------------------------------------------------------------- 1 | -DFOO -DBAR=bar 2 | -------------------------------------------------------------------------------- /test/lang/flags/main.clay: -------------------------------------------------------------------------------- 1 | import printer.formatter.(repr); 2 | import printer.(println); 3 | 4 | probeFlags() = Flag?("FOO"), Flag?("BAR"), Flag?("BAS"), 5 | Flag("FOO"), Flag("BAR"), Flag("BAS"); 6 | 7 | record WackyType[..X] (); 8 | 9 | main() { 10 | println(repr(..probeFlags())); 11 | println(WackyType[..probeFlags()]); 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/flags/out.txt: -------------------------------------------------------------------------------- 1 | true, true, false, "", "bar", "" 2 | WackyType[true, true, false, "", "bar", ""] 3 | -------------------------------------------------------------------------------- /test/lang/floats/literals/long/main.unix.x86.clay: -------------------------------------------------------------------------------- 1 | import printer.formatter.(repr); 2 | import printer.(println); 3 | 4 | main() { 5 | println(repr(0x8.0000_0000_0000_001p111l)); 6 | println(repr(0x8.0000_0000_0000_002p222l)); 7 | println(repr(0x8.0000_0000_0000_003p333l)); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/floats/literals/long/out.freebsd.txt: -------------------------------------------------------------------------------- 1 | 0x1.0000000000000002p+114fl 2 | 0x1.0000000000000004p+225fl 3 | 0x1.0000000000000006p+336fl 4 | -------------------------------------------------------------------------------- /test/lang/floats/literals/long/out.txt: -------------------------------------------------------------------------------- 1 | 0x8.000000000000001p+111fl 2 | 0x8.000000000000002p+222fl 3 | 0x8.000000000000003p+333fl 4 | -------------------------------------------------------------------------------- /test/lang/globalalias/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | alias two[T] = T(2); 4 | alias three[T] = T(3); 5 | 6 | main() { 7 | println(two[Int]); 8 | println(two[Float]); 9 | println(three[Int]); 10 | println(three[Float]); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /test/lang/globalalias/1/out.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | 3 4 | 3 5 | -------------------------------------------------------------------------------- /test/lang/globalalias/predicates/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/globalalias/predicates/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | [T] alias anyTwo[T] = T(2); 4 | 5 | [T when Integer?(T)] 6 | alias intTwo[T] = T(2); 7 | 8 | main() { 9 | println(anyTwo[Int]); 10 | println(anyTwo[Float]); 11 | println(intTwo[Int]); 12 | println(intTwo[Float]); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /test/lang/globalalias/predicates/2/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/globalalias/predicates/2/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | private Ok?() = true; 4 | 5 | [when Ok?()] alias touchable = 1; 6 | 7 | [when false] alias untouchable = 1; 8 | 9 | main() { 10 | println(touchable); 11 | println(untouchable); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /test/lang/globalvariables/ctorsdtors/out.txt: -------------------------------------------------------------------------------- 1 | ran ctor 2 | 123 3 | ran dtor 4 | -------------------------------------------------------------------------------- /test/lang/globalvariables/predicates/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/globalvariables/predicates/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | [T] var anyTwo[T] = T(2); 4 | 5 | [T when Integer?(T)] 6 | var intTwo[T] = T(2); 7 | 8 | main() { 9 | println(anyTwo[Int]); 10 | println(anyTwo[Float]); 11 | println(intTwo[Int]); 12 | println(intTwo[Float]); 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/globalvariables/predicates/2/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/globalvariables/predicates/2/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | private Ok?() = true; 4 | 5 | [when Ok?()] var touchable = 1; 6 | 7 | [when false] var untouchable = 1; 8 | 9 | main() { 10 | println(touchable); 11 | println(untouchable); 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/instrinsic/getoverload/out.txt: -------------------------------------------------------------------------------- 1 | Float 123 2 | String 123 3 | -------------------------------------------------------------------------------- /test/lang/instrinsic/hints/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo(x:Bool) = not usuallyEquals(x, #true); 4 | 5 | main() { 6 | println(foo(true), ' ', foo(false), ' ', #foo(true), ' ', #foo(false)); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/instrinsic/hints/out.txt: -------------------------------------------------------------------------------- 1 | false true false true 2 | -------------------------------------------------------------------------------- /test/lang/instrinsic/staticname/out.txt: -------------------------------------------------------------------------------- 1 | +: + 2 | String: Vector[Char] 3 | Vec: Vec 4 | hash: hash 5 | Array: Array 6 | Array[Bool, 10]: Array[Bool, 10] 7 | HashMap: HashMap 8 | HashMap[Int32, Int32]: HashMap[Int32, Int32] 9 | data.vectors.generic: data.vectors.generic 10 | Record?: Record? 11 | disp: disp 12 | -------------------------------------------------------------------------------- /test/lang/lambda/noarg/noarg.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | main() { 4 | println((() -> 1)()); 5 | println((() => 2)()); 6 | println((-> 3)()); 7 | println((=> 4)()); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/lambda/noarg/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | -------------------------------------------------------------------------------- /test/lang/lambda/variableastype/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo(T) = ((x:T) -> x)(219); 4 | 5 | main() { 6 | println(foo(Int), ' ', #foo(Int)); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/lambda/variableastype/out.txt: -------------------------------------------------------------------------------- 1 | 219 219 2 | -------------------------------------------------------------------------------- /test/lang/modules/attributes/literaltypes/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import printer.formatter.(repr); 3 | in __main__ (Float32, Int64); 4 | 5 | main() { 6 | println(repr(1.0 + 2.0)); 7 | println(repr(1 + 2)); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/modules/attributes/literaltypes/out.txt: -------------------------------------------------------------------------------- 1 | 0x1.800000p+1f 2 | 3l 3 | -------------------------------------------------------------------------------- /test/lang/modules/imports/aliasqualified/foo/bar/bas.clay: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/modules/imports/aliasqualified/foo/bar/bas.clay -------------------------------------------------------------------------------- /test/lang/modules/imports/aliasqualified/main.clay: -------------------------------------------------------------------------------- 1 | import foo.bar.bas; 2 | import printer.(println); 3 | 4 | private alias bas = foo.bar.bas; 5 | 6 | main() { 7 | bas; 8 | println("ok"); 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/modules/imports/aliasqualified/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous1/a.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("a.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous1/b.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("b.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous1/c.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("c.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous1/compilererr.txt: -------------------------------------------------------------------------------- 1 | ambiguous imported symbol: foo 2 | disambiguate with one of: 3 | import a.\(foo\); 4 | import b.\(foo\); 5 | import c.\(foo\); 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous1/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | import c.*; 4 | 5 | main() { foo(); } 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous2/a.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | external ("a_foo") foo() { println("a.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous2/b.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | external ("b_foo") foo() { println("b.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous2/compilererr.txt: -------------------------------------------------------------------------------- 1 | ambiguous imported symbol: foo 2 | disambiguate with one of: 3 | import a.\(foo\); 4 | import b.\(foo\); 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous2/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | 4 | main() { foo(); } 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous3/a.clay: -------------------------------------------------------------------------------- 1 | external ("a_foo") foo:Int; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous3/b.clay: -------------------------------------------------------------------------------- 1 | external ("b_foo") foo:Int; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous3/compilererr.txt: -------------------------------------------------------------------------------- 1 | ambiguous imported symbol: foo 2 | disambiguate with one of: 3 | import a.\(foo\); 4 | import b.\(foo\); 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous3/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | 4 | main() { return foo; } 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous4/a.clay: -------------------------------------------------------------------------------- 1 | var foo = "a.foo"; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous4/b.clay: -------------------------------------------------------------------------------- 1 | var foo = "b.foo"; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous4/compilererr.txt: -------------------------------------------------------------------------------- 1 | ambiguous imported symbol: foo 2 | disambiguate with one of: 3 | import a.\(foo\); 4 | import b.\(foo\); 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous4/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | import printer.(println); 4 | 5 | main() { println(foo); } 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous5/a.clay: -------------------------------------------------------------------------------- 1 | alias foo = "a.foo"; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous5/b.clay: -------------------------------------------------------------------------------- 1 | alias foo = "b.foo"; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous5/compilererr.txt: -------------------------------------------------------------------------------- 1 | ambiguous imported symbol: foo 2 | disambiguate with one of: 3 | import a.\(foo\); 4 | import b.\(foo\); 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/ambiguous5/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | import printer.(println); 4 | 5 | main() { println(foo); } 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/circular/bar.clay: -------------------------------------------------------------------------------- 1 | import foo; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/circular/compilererr.txt: -------------------------------------------------------------------------------- 1 | import loop: 2 | __main__ 3 | foo 4 | bar 5 | foo 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/circular/foo.clay: -------------------------------------------------------------------------------- 1 | import bar; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/circular/main.clay: -------------------------------------------------------------------------------- 1 | import foo; 2 | 3 | main() { 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision1/a.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("a.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision1/b.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("b.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision1/compilererr.txt: -------------------------------------------------------------------------------- 1 | name imported already: foo 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision1/main.clay: -------------------------------------------------------------------------------- 1 | import a.(foo); 2 | import b.(foo); 3 | 4 | main() { foo(); } 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision2/a.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("a.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision2/b.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("b.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision2/compilererr.txt: -------------------------------------------------------------------------------- 1 | name imported already: foo 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/collision2/main.clay: -------------------------------------------------------------------------------- 1 | import a.(foo); 2 | import b as foo; 3 | 4 | main() { foo(); } 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated1/a.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("a.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated1/b.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("b.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated1/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | import a.(foo); 4 | 5 | main() { foo(); } 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated1/out.txt: -------------------------------------------------------------------------------- 1 | a.foo 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated2/a.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("a.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated2/b.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("b.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated2/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | import printer.(println); 4 | 5 | foo() { println("__main__.foo"); } 6 | 7 | main() { foo(); } 8 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated2/out.txt: -------------------------------------------------------------------------------- 1 | __main__.foo 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated3/a.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("a.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated3/b.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("b.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated3/foo.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | foo() { println("foo.foo"); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated3/main.clay: -------------------------------------------------------------------------------- 1 | import a.*; 2 | import b.*; 3 | import foo; 4 | 5 | main() { foo.foo(); } 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/disambiguated3/out.txt: -------------------------------------------------------------------------------- 1 | foo.foo 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted1/foo/bar.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | a() { println("ok"); } 3 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted1/main.clay: -------------------------------------------------------------------------------- 1 | import foo.bar; 2 | 3 | main() { foo.bar.a(); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted1/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted2/foo.clay: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/modules/imports/dotted2/foo.clay -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted2/foo/bar.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | a() { println("ok"); } 3 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted2/main.clay: -------------------------------------------------------------------------------- 1 | import foo; 2 | import foo.bar; 3 | 4 | main() { foo.bar.a(); } 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted2/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted3/foo/bar.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | a() { println("ok"); } 3 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted3/main.clay: -------------------------------------------------------------------------------- 1 | import foo.bar; 2 | 3 | main() { 4 | var foo = 1; 5 | foo.bar.a(); 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted3/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted4/foo/bar.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | a() { println("ok"); } 3 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted4/main.clay: -------------------------------------------------------------------------------- 1 | import foo.bar; 2 | 3 | main() { 4 | (-> { foo.bar.a(); })(); 5 | } 6 | -------------------------------------------------------------------------------- /test/lang/modules/imports/dotted4/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/issue266/a.clay: -------------------------------------------------------------------------------- 1 | foo(){} -------------------------------------------------------------------------------- /test/lang/modules/imports/issue266/a/b.clay: -------------------------------------------------------------------------------- 1 | foo(){} -------------------------------------------------------------------------------- /test/lang/modules/imports/issue266/test.clay: -------------------------------------------------------------------------------- 1 | import a; 2 | import a.b; 3 | 4 | main() { 5 | a.foo(); 6 | a.b.foo(); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/modules/imports/publicqualified/compilererr.txt: -------------------------------------------------------------------------------- 1 | public imports of dotted module paths must have an "as " alias 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/publicqualified/foo.clay: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/modules/imports/publicqualified/foo.clay -------------------------------------------------------------------------------- /test/lang/modules/imports/publicqualified/foo/bar.clay: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lang/modules/imports/publicqualified/foo/bar.clay -------------------------------------------------------------------------------- /test/lang/modules/imports/publicqualified/main.clay: -------------------------------------------------------------------------------- 1 | public import foo.bar; 2 | -------------------------------------------------------------------------------- /test/lang/modules/imports/suggest/compilererr.txt: -------------------------------------------------------------------------------- 1 | undefined name: puts 2 | maybe you need one of: 3 | import libc.\(puts\); 4 | import libc.generated.\(puts\); 5 | -------------------------------------------------------------------------------- /test/lang/modules/imports/suggest/main.clay: -------------------------------------------------------------------------------- 1 | import libc; 2 | 3 | main() { puts(cstring("import me")); } 4 | -------------------------------------------------------------------------------- /test/lang/modules/introspection/foo.clay: -------------------------------------------------------------------------------- 1 | public import __primitives__; 2 | public import printer.(println); 3 | 4 | define A; 5 | record B (); 6 | record C[T] (); 7 | enum D (E, F); 8 | variant G (B); 9 | variant H[T] (C[T]); 10 | alias I = 0; 11 | alias J[T] = 0; 12 | var K = 0; 13 | var L[T] = 0; 14 | -------------------------------------------------------------------------------- /test/lang/modules/introspection/out.txt: -------------------------------------------------------------------------------- 1 | __main__ 2 | __main__ 3 | __primitives__ 4 | printer 5 | true 6 | true 7 | true 8 | true 9 | true 10 | true 11 | true 12 | true 13 | 1963 14 | yeah yeah yeah 15 | A 16 | B 17 | C 18 | D 19 | E 20 | F 21 | G 22 | H 23 | I 24 | J 25 | K 26 | L 27 | -------------------------------------------------------------------------------- /test/lang/modules/issue272/foo.clay: -------------------------------------------------------------------------------- 1 | public import __primitives__; 2 | public import printer.(println); 3 | 4 | define A; 5 | record B (); 6 | record C[T] (); 7 | enum D (E, F); 8 | variant G (B); 9 | variant H[T] (C[T]); 10 | alias I = 0; 11 | alias J[T] = 0; 12 | var K = 0; 13 | var L[T] = 0; 14 | -------------------------------------------------------------------------------- /test/lang/modules/issue272/foo/bar.clay: -------------------------------------------------------------------------------- 1 | public import __primitives__; 2 | public import printer.(println); 3 | 4 | define A; 5 | record B (); 6 | record C[T] (); 7 | enum D (E, F); 8 | variant G (B); 9 | variant H[T] (C[T]); 10 | alias I = 0; 11 | alias J[T] = 0; 12 | var K = 0; 13 | var L[T] = 0; 14 | -------------------------------------------------------------------------------- /test/lang/modules/issue272/main.clay: -------------------------------------------------------------------------------- 1 | import 2 | foo, 3 | foo.(A, B), 4 | foo.bar, 5 | printer, 6 | printer.(println), 7 | __primitives__; 8 | 9 | main() { 10 | println(StaticModule(A) == StaticModule(B)); 11 | println(StaticModule(foo.bar.A) == foo.bar); 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/modules/issue272/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | true 3 | -------------------------------------------------------------------------------- /test/lang/modules/name/out.txt: -------------------------------------------------------------------------------- 1 | +: core.operators 2 | String: data.vectors 3 | Vec: __primitives__ 4 | hash: hash 5 | Array: __primitives__ 6 | Array[Bool, 10]: __primitives__ 7 | HashMap: data.hashmaps 8 | HashMap[Int32, Int32]: data.hashmaps 9 | data.vectors.generic: data.vectors.generic 10 | Record?: __primitives__ 11 | disp: __main__ 12 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 1 value, but right side has 0 values 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/1/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x = 0; 3 | x = (); 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/2/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 1 value, but right side has 2 values 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/2/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x = 0; 3 | x = 1, 2; 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/3/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 2 values, but right side has 0 values 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/3/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x, y = 1, 2; 3 | x, y = (); 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/4/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 2 values, but right side has 1 value 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/4/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x, y = 0, 1; 3 | x, y = 1; 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/5/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 2 values, but right side has 3 values 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/assignmismatch/5/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x, y = 1, 2; 3 | x, y = 1, 2, 3; 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/multivalues/binding/out.txt: -------------------------------------------------------------------------------- 1 | 1 3.5 2 | 6 7 3 | 9 10 4 | WackyType[16, 20.5] 5 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 1 value, but right side has 0 values 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/1/main.clay: -------------------------------------------------------------------------------- 1 | void() {} 2 | 3 | main() { 4 | var x = void(); 5 | } 6 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/2/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 1 value, but right side has 2 values 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/2/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x = 1, 2; 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/3/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 2 values, but right side has 0 values 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/3/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x, y = (); 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/4/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 2 values, but right side has 1 value 2 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/4/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x, y = 1; 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/5/compilererr.txt: -------------------------------------------------------------------------------- 1 | left side has 2 values, but right side has 3 values -------------------------------------------------------------------------------- /test/lang/multivalues/bindingmismatch/5/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x, y = 1, 2, 3; 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/operators/bitwise/main.clay: -------------------------------------------------------------------------------- 1 | import printer.formatter.*; 2 | import printer.(println); 3 | 4 | main() { 5 | println(hex(bitrol(0x12345678u, 4))); 6 | println(hex(bitror(0x12345678u, 4))); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/operators/bitwise/out.txt: -------------------------------------------------------------------------------- 1 | 23456781 2 | 81234567 3 | -------------------------------------------------------------------------------- /test/lang/operators/comparison/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | var x = 5; 5 | println(4 < x <= 8); 6 | println(7 == x > 2); 7 | println(5 == x >= 2 != x < 9); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/operators/comparison/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | false 3 | true 4 | -------------------------------------------------------------------------------- /test/lang/operators/custom/foo.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | define (~~); 4 | 5 | overload (~~)(a, b) { println("~~"); } 6 | -------------------------------------------------------------------------------- /test/lang/operators/custom/out.txt: -------------------------------------------------------------------------------- 1 | ** 2 | ~~ 3 | ~~ Float 4 | ~~ Double 5 | ** 6 | ~~ 7 | ~~ Float 8 | ~~ Double 9 | ~~ 10 | ~~ Float 11 | ~~ Double 12 | #(~~) 1 13 | #(~~) 1 14 | #(~~) 2 15 | #(~~) 2 16 | 5 17 | 5 18 | -5 19 | -------------------------------------------------------------------------------- /test/lang/operators/custom2/out.txt: -------------------------------------------------------------------------------- 1 | 4096 2 | 4096 3 | 4096 4 | 262144 5 | 262144 6 | 4096 7 | 262144 8 | 262144 9 | 4096 10 | 4096 11 | 262144 12 | -------------------------------------------------------------------------------- /test/lang/operators/extendedassignment/butnottooextended1/compilererr.txt: -------------------------------------------------------------------------------- 1 | no matching overload found 2 | -------------------------------------------------------------------------------- /test/lang/operators/extendedassignment/butnottooextended1/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | 1 = 2; 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/operators/extendedassignment/butnottooextended2/compilererr.txt: -------------------------------------------------------------------------------- 1 | no matching overload found 2 | -------------------------------------------------------------------------------- /test/lang/operators/extendedassignment/butnottooextended2/main.clay: -------------------------------------------------------------------------------- 1 | import data.vectors.*; 2 | 3 | main() { 4 | Vector[Int]() = Vector[Int](); 5 | } 6 | -------------------------------------------------------------------------------- /test/lang/operators/extendedassignment/out.txt: -------------------------------------------------------------------------------- 1 | indexAssign(x, 10, hello) 2 | staticIndexAssign(x, 20, hi) 3 | fieldRefAssign(x, bar, hola) 4 | indexUpdateAssign(+, x, 30, 100) 5 | staticIndexUpdateAssign(*, x, 40, 200) 6 | fieldRefUpdateAssign(\, x, baz, 300) 7 | -------------------------------------------------------------------------------- /test/lang/operators/extendedassignment2/out.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 4 4 | 5 | 3 6 | 4 7 | 5 8 | 9 | 30 10 | 40 11 | 50 12 | 13 | -------------------------------------------------------------------------------- /test/lang/operators/pod/initializers/out.txt: -------------------------------------------------------------------------------- 1 | false 2 | '\0' 3 | 0 4 | 0 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0j 14 | 0j 15 | 0+0j 16 | 0+0j 17 | ZERO 18 | [false, 0, 0] 19 | -------------------------------------------------------------------------------- /test/lang/operators/precedence/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main(){ 4 | 5 | println(2 + 3 * 4); 6 | println(8 \ 2 + 3 * 4); 7 | println(22.0 - 12.0 / 2.0); 8 | println(3 + 4 > 6); 9 | println(2 <= 3 * 4 > 6); 10 | var zero, ..x = integers(#10); 11 | println(2 + (..x) * 2); 12 | println((..x) * 2 > 9 < 1000000); 13 | } -------------------------------------------------------------------------------- /test/lang/operators/precedence/out.txt: -------------------------------------------------------------------------------- 1 | 14 2 | 16 3 | 16 4 | true 5 | true 6 | 725762 7 | true 8 | -------------------------------------------------------------------------------- /test/lang/operators/proxyassignment/out.txt: -------------------------------------------------------------------------------- 1 | 1, 2 2 | 3, 2 3 | 3, 4 4 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/1-2/compilererr.txt: -------------------------------------------------------------------------------- 1 | overload has more parameters \(2\) than declaration \(1\) 2 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/1-2/main.clay: -------------------------------------------------------------------------------- 1 | define foo(a); 2 | 3 | overload foo(a, b) = 1; 4 | 5 | main() {} 6 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/1-2v/compilererr.txt: -------------------------------------------------------------------------------- 1 | overload has more parameters \(2\+\) than declaration \(1\) 2 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/1-2v/main.clay: -------------------------------------------------------------------------------- 1 | define foo(a); 2 | 3 | overload foo(a, b, ..c) = 1; 4 | 5 | main() {} 6 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/2-0/compilererr.txt: -------------------------------------------------------------------------------- 1 | overload has fewer parameters \(0\) than declaration \(2\) 2 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/2-0/main.clay: -------------------------------------------------------------------------------- 1 | define foo(a, b); 2 | 3 | overload foo() = 1; 4 | 5 | main() {} 6 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/2v-0/compilererr.txt: -------------------------------------------------------------------------------- 1 | overload has fewer parameters \(0\) than declaration \(2\+\) 2 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/param/2v-0/main.clay: -------------------------------------------------------------------------------- 1 | define foo(a, b, ..c); 2 | 3 | overload foo() = 1; 4 | 5 | main() {} 6 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/return/1-2/compilererr.txt: -------------------------------------------------------------------------------- 1 | overload return count \(2\) must be equal to define return count \(1\) 2 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/return/1-2/main.clay: -------------------------------------------------------------------------------- 1 | define foo(a): Int; 2 | 3 | overload foo(a): Int, Int = 1, 2; 4 | 5 | main() {} 6 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/return/2-0/compilererr.txt: -------------------------------------------------------------------------------- 1 | overload return count \(0\) must be equal to define return count \(2\) 2 | -------------------------------------------------------------------------------- /test/lang/overloads/declmismatch/return/2-0/main.clay: -------------------------------------------------------------------------------- 1 | define foo(a): Int, Int; 2 | 3 | overload foo(a): {} 4 | 5 | main() {} 6 | -------------------------------------------------------------------------------- /test/lang/overloads/final/ambiguous/buildflags.txt: -------------------------------------------------------------------------------- 1 | -final-overloads 2 | -------------------------------------------------------------------------------- /test/lang/overloads/final/ambiguous/compilererr.txt: -------------------------------------------------------------------------------- 1 | error: call matches ambiguous overloads 2 | -------------------------------------------------------------------------------- /test/lang/overloads/final/ambiguous/main.clay: -------------------------------------------------------------------------------- 1 | define foo; 2 | overload foo(x) = true; 3 | overload foo(y:Int32) = false; 4 | 5 | main() { 6 | foo(2); 7 | } -------------------------------------------------------------------------------- /test/lang/overloads/final/default/buildflags.txt: -------------------------------------------------------------------------------- 1 | -final-overloads 2 | -------------------------------------------------------------------------------- /test/lang/overloads/final/default/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | define foo; 4 | default foo(x) = 1; 5 | default foo(x, y) = 2; 6 | overload foo(x: Int32) = 3; 7 | overload foo(x: Char, y: Byte) = 4; 8 | 9 | main() { 10 | println(foo("bar")); 11 | println(foo(2, "bar")); 12 | println(foo(2)); 13 | println(foo('a', 2uss)); 14 | } -------------------------------------------------------------------------------- /test/lang/overloads/final/default/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | -------------------------------------------------------------------------------- /test/lang/overloads/final/unambiguous/buildflags.txt: -------------------------------------------------------------------------------- 1 | -final-overloads 2 | -------------------------------------------------------------------------------- /test/lang/overloads/final/unambiguous/test.clay: -------------------------------------------------------------------------------- 1 | define foo; 2 | overload foo(x) = false; 3 | overload foo() = true; 4 | overload foo(x, y) = "OK"; 5 | 6 | main() { 7 | foo(2); 8 | foo(); 9 | foo(2, 3); 10 | } -------------------------------------------------------------------------------- /test/lang/overloads/final/unambiguous2/buildflags.txt: -------------------------------------------------------------------------------- 1 | -final-overloads 2 | -------------------------------------------------------------------------------- /test/lang/overloads/final/unambiguous2/test.clay: -------------------------------------------------------------------------------- 1 | define foo; 2 | overload foo(x) = true; 3 | overload foo(y:Int32) = false; 4 | 5 | main() { 6 | foo("bar"); 7 | } -------------------------------------------------------------------------------- /test/lang/overloads/patterncallable/out.txt: -------------------------------------------------------------------------------- 1 | 4 2 | 8 3 | 1 4 | -------------------------------------------------------------------------------- /test/lang/overloads/pred-eval-loop/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate evaluation loop 2 | -------------------------------------------------------------------------------- /test/lang/overloads/pred-eval-loop/main.clay: -------------------------------------------------------------------------------- 1 | [when foo()] 2 | foo() {} 3 | 4 | main() { 5 | foo(); 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/overloads/private/bad-with-interface/baz.clay: -------------------------------------------------------------------------------- 1 | define foo() private overload; 2 | -------------------------------------------------------------------------------- /test/lang/overloads/private/bad-with-interface/compilererr.txt: -------------------------------------------------------------------------------- 1 | symbol foo is declared as private for overload 2 | -------------------------------------------------------------------------------- /test/lang/overloads/private/bad-with-interface/main.clay: -------------------------------------------------------------------------------- 1 | import baz.*; 2 | 3 | overload foo() = 1; 4 | 5 | main() { 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/overloads/private/bad-wo-interface/baz.clay: -------------------------------------------------------------------------------- 1 | define foo private overload; 2 | -------------------------------------------------------------------------------- /test/lang/overloads/private/bad-wo-interface/compilererr.txt: -------------------------------------------------------------------------------- 1 | symbol foo is declared as private for overload 2 | -------------------------------------------------------------------------------- /test/lang/overloads/private/bad-wo-interface/main.clay: -------------------------------------------------------------------------------- 1 | import baz.*; 2 | 3 | overload foo() = 1; 4 | 5 | main() { 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/overloads/private/good/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | define foo private overload; 4 | 5 | overload foo() = 0; 6 | overload foo(x) = 1; 7 | 8 | define bar(a, b) private overload; 9 | 10 | overload bar(a, b) = a + b; 11 | 12 | main() { 13 | println(foo()); 14 | println(foo(true)); 15 | println(bar(1, 1)); 16 | } 17 | -------------------------------------------------------------------------------- /test/lang/overloads/private/good/out.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | -------------------------------------------------------------------------------- /test/lang/overloads/standalone/compilererr.txt: -------------------------------------------------------------------------------- 1 | standalone functions cannot be overloaded 2 | -------------------------------------------------------------------------------- /test/lang/overloads/standalone/main.clay: -------------------------------------------------------------------------------- 1 | foo() {} 2 | 3 | overload foo(x) {} 4 | 5 | main() {} 6 | -------------------------------------------------------------------------------- /test/lang/overloads/withinterface/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | true 3 | false 4 | -------------------------------------------------------------------------------- /test/lang/patterns/arguments/out.txt: -------------------------------------------------------------------------------- 1 | 12345678 2 | 234568 3 | 9 4 | -------------------------------------------------------------------------------- /test/lang/patterns/out.txt: -------------------------------------------------------------------------------- 1 | In = Int32 2 | Out = Int32 3 | In = 4 | Out = Int32 5 | In = Int32 6 | Out = 7 | In = 8 | Out = 9 | In = Int32Bool 10 | Out = Int32 11 | In = Int32 12 | Out = Int32Bool 13 | In = Int32Bool 14 | Out = Bool 15 | In = Int32 16 | Out = Bool 17 | -------------------------------------------------------------------------------- /test/lang/pointers/indexing/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import data.vectors.*; 3 | main() { 4 | var v = Vector(range(256)); 5 | var p = begin(v); 6 | println(p[224_uss]); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/pointers/indexing/1/out.txt: -------------------------------------------------------------------------------- 1 | 224 2 | -------------------------------------------------------------------------------- /test/lang/privateimports/foo.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | bar() { println("bar"); } 3 | private bas() { println("bas"); } 4 | -------------------------------------------------------------------------------- /test/lang/privateimports/main.clay: -------------------------------------------------------------------------------- 1 | import foo.(bar, private bas); 2 | 3 | main() { 4 | bar(); 5 | bas(); 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/privateimports/out.txt: -------------------------------------------------------------------------------- 1 | bar 2 | bas 3 | -------------------------------------------------------------------------------- /test/lang/privatemain/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | private main() { println("ok"); } 4 | -------------------------------------------------------------------------------- /test/lang/privatemain/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/records/copyable-if-fields-copyable/test.clay: -------------------------------------------------------------------------------- 1 | record NonCopyable ( 2 | ); 3 | 4 | overload RegularRecord?(#NonCopyable) = false; 5 | 6 | staticassert (not Copyable?(NonCopyable)); 7 | 8 | record RecordWithNonCopyableField ( 9 | a: Int, 10 | b: NonCopyable, 11 | ); 12 | 13 | staticassert (not Copyable?(RecordWithNonCopyableField)); 14 | 15 | main() { 16 | } 17 | -------------------------------------------------------------------------------- /test/lang/records/initialization/out.txt: -------------------------------------------------------------------------------- 1 | Foo(0, a should be 0) 2 | Foo(10, a should be 5 times two) 3 | -------------------------------------------------------------------------------- /test/lang/records/movable-if-fields-movable/test.clay: -------------------------------------------------------------------------------- 1 | record NonMovable ( 2 | ); 3 | 4 | overload RegularRecord?(#NonMovable) = false; 5 | 6 | staticassert (not Movable?(NonMovable)); 7 | 8 | record RecordWithNonMovableField ( 9 | a: Int, 10 | b: NonMovable, 11 | ); 12 | 13 | staticassert (not Movable?(RecordWithNonMovableField)); 14 | 15 | main() { 16 | } 17 | -------------------------------------------------------------------------------- /test/lang/records/params/int-param/test.clay: -------------------------------------------------------------------------------- 1 | record Foo[A] ( 2 | a: Type(A), 3 | ); 4 | 5 | main() { 6 | var foo = Foo[1](); 7 | if (foo.a != 0) 8 | return 1; 9 | if (Type(foo.a) != Int) 10 | return 2; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/records/params/string-param/test.clay: -------------------------------------------------------------------------------- 1 | record Foo[A] ( 2 | a: Type(A), 3 | ); 4 | 5 | main() { 6 | var foo = Foo["abc"](); 7 | if (foo.a != "abc") 8 | return 1; 9 | if (Type(foo.a) != Static["abc"]) 10 | return 2; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/records/params/tuple-of-string-param/test.clay: -------------------------------------------------------------------------------- 1 | record Foo[A] ( 2 | a: Type(A), 3 | ); 4 | 5 | main() { 6 | var foo = Foo[["abc", Int]](); 7 | if (foo.a != ["abc", Int]) 8 | return 1; 9 | if (Type(foo.a) != Tuple[Static["abc"], Static[Int]]) 10 | return 2; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/records/predicates/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/records/predicates/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | [T] record Foo[T] (x:T); 3 | 4 | [T when Integer?(T)] record Bar[T] (x:T); 5 | 6 | main() { 7 | println(Foo(1)); 8 | println(Foo(1.0)); 9 | println(Bar(1)); 10 | println(Bar(1.0)); 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/records/variadics/out.txt: -------------------------------------------------------------------------------- 1 | 2,6,pigs,[3, Float32],7 2 | 6,pigs,[3, Float32] 3 | 6,pigs,[3, Float32] 4 | -------------------------------------------------------------------------------- /test/lang/returntypes/analyzer/out.txt: -------------------------------------------------------------------------------- 1 | [Int32, Int32] 2 | [ByRef[Int32], Int32] 3 | [Int32, Int32] 4 | [ByRef[Int32], Int32] 5 | [10, 11] 6 | -------------------------------------------------------------------------------- /test/lang/returntypes/implicit/test.clay: -------------------------------------------------------------------------------- 1 | 2 | bar(..y) = 2,4; 3 | 4 | foo(x, y) : Int32, Int32 = bar(x,y); 5 | 6 | 7 | main() { 8 | 9 | var a, b = foo(2.0f, 3); 10 | 11 | } -------------------------------------------------------------------------------- /test/lang/returntypes/spec/out.txt: -------------------------------------------------------------------------------- 1 | 12 2 | a = 3, b = 4 3 | void 4 | -------------------------------------------------------------------------------- /test/lang/staticassert/incond/correct/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | bar() { 4 | staticassert(true); 5 | return true; 6 | } 7 | 8 | [when bar()] 9 | foo() = "$"; 10 | 11 | main() { 12 | println(foo()); 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/staticassert/incond/correct/out.txt: -------------------------------------------------------------------------------- 1 | $ 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/incond/wrong/compilererr.txt: -------------------------------------------------------------------------------- 1 | static assert failed 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/incond/wrong/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | bar() { 4 | staticassert(false); 5 | return true; 6 | } 7 | 8 | [when bar()] 9 | foo() = "$"; 10 | 11 | main() { 12 | println(foo()); 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/staticassert/infunction/correct/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | main() { 4 | var i = 17s; 5 | staticassert(TypeSize(Type(i)) == 2); 6 | println("$"); 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/staticassert/infunction/correct/out.txt: -------------------------------------------------------------------------------- 1 | $ 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/infunction/wrong/compilererr.txt: -------------------------------------------------------------------------------- 1 | static assert failed 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/infunction/wrong/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | staticassert(1 == 2); 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/staticassert/inlambda/correct/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | main() { 4 | var i = 17s; 5 | println((() -> { staticassert(Type(i) == Int16); return "$"; })()); 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/staticassert/inlambda/correct/out.txt: -------------------------------------------------------------------------------- 1 | $ 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/inlambda/wrong/compilererr.txt: -------------------------------------------------------------------------------- 1 | static assert failed 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/inlambda/wrong/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | main() { 4 | var i = 17s; 5 | println((() -> { staticassert(Type(i) == Char); return "$"; })()); 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/staticassert/message/good/compilererr.txt: -------------------------------------------------------------------------------- 1 | error: static assert failed: T should be smaller than 5 bytes but is 8 bytes 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/message/good/main.clay: -------------------------------------------------------------------------------- 1 | 2 | [T, N] 3 | foo(t: T, #N) { 4 | staticassert(TypeSize(T) < N, "T should be smaller than ", #N, " bytes but is ", #TypeSize(T), " bytes"); 5 | } 6 | 7 | main() { 8 | foo(17l, #5); 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/staticassert/message/wrong-when-assert/compilererr.txt: -------------------------------------------------------------------------------- 1 | error: undefined name: Asdfgh 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/message/wrong-when-assert/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | staticassert(1 < 0, "type not found here", Asdfgh); 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/staticassert/message/wrong-when-ok/compilererr.txt: -------------------------------------------------------------------------------- 1 | undefined name: Qwerty 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/message/wrong-when-ok/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | staticassert(true, "fails because message ", Qwerty); 3 | } 4 | -------------------------------------------------------------------------------- /test/lang/staticassert/toplevel/correct/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | record Foo (); 4 | 5 | staticassert(Record?(Foo)); 6 | 7 | main() { 8 | println("$"); 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/staticassert/toplevel/correct/out.txt: -------------------------------------------------------------------------------- 1 | $ 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/toplevel/wrong/compilererr.txt: -------------------------------------------------------------------------------- 1 | static assert failed 2 | -------------------------------------------------------------------------------- /test/lang/staticassert/toplevel/wrong/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | record Foo (); 4 | 5 | staticassert(Variant?(Foo)); 6 | 7 | main() {} 8 | -------------------------------------------------------------------------------- /test/lang/stmt/eval/out.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 34 3 | bye 4 | -------------------------------------------------------------------------------- /test/lang/stmt/for/static/forwarded/out.txt: -------------------------------------------------------------------------------- 1 | Foo(): Foo(1) 2 | Foo(): Foo(2) 3 | moveUnsafe(): Foo(1) 4 | moveUnsafe(): Foo(2) 5 | {Foo(1), Foo(2)} 6 | destroy(): Foo(1) 7 | destroy(): Foo(2) 8 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/eval/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | foo(t) { 4 | if (#(Type(t) == Int)) { 5 | return 0 + t; 6 | } else { 7 | return false or t; 8 | } 9 | } 10 | 11 | main() { 12 | println(#foo(1)); 13 | println(#foo(true)); 14 | } 15 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/eval/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | true 3 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/if-else/out.txt: -------------------------------------------------------------------------------- 1 | 17 2 | 19 3 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/if-expr/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | main() { 4 | var a = if (#(TypeSize(Int32) == 4)) 4 else "something wrong"; 5 | println(a, " ", Type(a)); 6 | var b = if (#(Type(a) == Float)) true else "not float"; 7 | println(b, " ", Type(b)); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/if-expr/out.txt: -------------------------------------------------------------------------------- 1 | 4 Int32 2 | not float Static["not float"] 3 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/if-only/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | 3 | [I when Integer?(I)] 4 | printInteger(i: I) { 5 | println("it is integer"); 6 | } 7 | 8 | foo(t) { 9 | if (#Integer?(Type(t))) { 10 | printInteger(t); 11 | } 12 | } 13 | 14 | main() { 15 | foo(1); 16 | foo(1.0); 17 | foo("aa"); 18 | } 19 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/if-only/out.txt: -------------------------------------------------------------------------------- 1 | it is integer 2 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/scope/compilererr.txt: -------------------------------------------------------------------------------- 1 | undefined name: x 2 | -------------------------------------------------------------------------------- /test/lang/stmt/if/static/scope/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | if (#true) { 3 | var x = 1; 4 | } 5 | x; 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/stmt/switch/multivalue/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | multi() = 1, 2; 3 | 4 | main() { 5 | switch (2) 6 | case (..multi()) 7 | println("ok"); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/stmt/switch/multivalue/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/stmt/switch/out.txt: -------------------------------------------------------------------------------- 1 | {[0, zero], [1, one], [2, two or three], [3, two or three], [4, other], [5, other]} 2 | -------------------------------------------------------------------------------- /test/lang/stringliterals/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main() { 3 | println('>', """""", '<'); 4 | println('>', """triple "quoted" string""", '<'); 5 | println('>', """"triple quoted string"""", '<'); 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/stringliterals/out.txt: -------------------------------------------------------------------------------- 1 | >< 2 | >triple "quoted" string< 3 | >"triple quoted string"< 4 | -------------------------------------------------------------------------------- /test/lang/throwingbranches/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | record FooException (); 3 | instance Exception (FooException); 4 | 5 | define foo; 6 | overload foo(x: Int) : Int { throw FooException(); } 7 | overload foo(x: Float) : Int { return 5; } 8 | 9 | variant Foo (Int, Float); 10 | 11 | fooFoo(x: Foo) = foo(*x); 12 | 13 | main() { var x = Foo(1.0f); println(fooFoo(x)); } 14 | -------------------------------------------------------------------------------- /test/lang/throwingbranches/out.txt: -------------------------------------------------------------------------------- 1 | 5 2 | -------------------------------------------------------------------------------- /test/lang/tuples/1/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | true 3 | true 4 | true 5 | true 6 | values: 7 | values: 1 8 | values: 1, 2 9 | values: 1, 2, 3 10 | -------------------------------------------------------------------------------- /test/lang/tuples/emptytuple/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | bar1() { 4 | println("bar1"); 5 | return 5, 6; 6 | } 7 | 8 | bar2() { 9 | println("bar2"); 10 | } 11 | 12 | main() { 13 | var a = Tuple(..bar1()); 14 | var b = Tuple(..bar2()); 15 | } 16 | -------------------------------------------------------------------------------- /test/lang/tuples/emptytuple/out.txt: -------------------------------------------------------------------------------- 1 | bar1 2 | bar2 3 | -------------------------------------------------------------------------------- /test/lang/tuples/equality/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | define X; 4 | define Y; 5 | define Z; 6 | 7 | main() { 8 | println([] == []); 9 | println([1, "2"] == [1, "2"]); 10 | println([1, "2"] == [1u, StringLiteralRef("2")]); 11 | println([X, Y] == [X, Y]); 12 | println([X, Y] != [Y, X]); 13 | println([X, Y] != [X, Y, Z]); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test/lang/tuples/equality/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | true 3 | true 4 | true 5 | true 6 | true 7 | -------------------------------------------------------------------------------- /test/lang/tuples/single/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.formatter.(repr); 2 | import printer.(println); 3 | 4 | [..T] foo(x:Tuple[..T]) { println(repr(..T)); } 5 | 6 | main() { 7 | foo([]); 8 | foo([1]); 9 | foo([1, '2']); 10 | } 11 | -------------------------------------------------------------------------------- /test/lang/tuples/single/1/out.txt: -------------------------------------------------------------------------------- 1 | 2 | Int32 3 | Int32, Char 4 | -------------------------------------------------------------------------------- /test/lang/tuples/single/2/out.txt: -------------------------------------------------------------------------------- 1 | 2 | Int32 3 | Int32, Char 4 | not a tuple 5 | -------------------------------------------------------------------------------- /test/lang/tuples/staticindexing/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main() { 3 | println([0,[10,11,[120,121]],2].1.0x2.0); 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/tuples/staticindexing/out.txt: -------------------------------------------------------------------------------- 1 | 120 2 | -------------------------------------------------------------------------------- /test/lang/tuples/staticindexing/ref-rvalue/test.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var t = [true]; 3 | staticassert(LValue?(t.0)); 4 | staticassert(RValue?(move(t).0)); 5 | } 6 | -------------------------------------------------------------------------------- /test/lang/tuples/types/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main() { 3 | println(Type([]) == Tuple[]); 4 | println(Type([1]) == Tuple[Int]); 5 | println(Type([1, 2.0]) == Tuple[Int, Double]); 6 | } 7 | -------------------------------------------------------------------------------- /test/lang/tuples/types/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | true 3 | true 4 | -------------------------------------------------------------------------------- /test/lang/types/newtype/equality/main.clay: -------------------------------------------------------------------------------- 1 | // base type inequality 2 | import printer.(println); 3 | 4 | newtype Foo = Int32; 5 | 6 | main() { 7 | println(Type(Foo) == BaseType(Foo)); 8 | } -------------------------------------------------------------------------------- /test/lang/types/newtype/equality/out.txt: -------------------------------------------------------------------------------- 1 | false 2 | -------------------------------------------------------------------------------- /test/lang/types/newtype/out.txt: -------------------------------------------------------------------------------- 1 | Type(Foo) = Static[Foo] 2 | TypeSize(Foo) = 24 3 | BaseType(Foo) = Bar 4 | NewType?(Foo) = true 5 | Type(a) = Foo 6 | 123, 789 7 | Bar, Bar(123, 456, 789) 8 | -------------------------------------------------------------------------------- /test/lang/types/valueSize/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main() { 3 | println(valueSize(1) == TypeSize(Int)); 4 | } 5 | -------------------------------------------------------------------------------- /test/lang/types/valueSize/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/1/out.txt: -------------------------------------------------------------------------------- 1 | 720 2 | Array[Int32, 10]BoolInt32NodeA[Tuple[Int32, Bool]]Char 3 | -------------------------------------------------------------------------------- /test/lang/uncategorized/10/out.txt: -------------------------------------------------------------------------------- 1 | uint value = 3 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/11/out.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 20 3 | 30 4 | -------------------------------------------------------------------------------- /test/lang/uncategorized/12/out.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 20 3 | 30 4 | 40 5 | 50 6 | 60 7 | 1 8 | 8 9 | 27 10 | 64 11 | 125 12 | 216 13 | -------------------------------------------------------------------------------- /test/lang/uncategorized/13/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 100 8 | 200 9 | 300 10 | 400 11 | 500 12 | 600 13 | -------------------------------------------------------------------------------- /test/lang/uncategorized/14/out.txt: -------------------------------------------------------------------------------- 1 | sum with lambda = 0 2 | sum with block = 21 3 | 10 4 | 11 5 | 12 6 | -------------------------------------------------------------------------------- /test/lang/uncategorized/15/out.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 4 3 | 6 4 | 8 5 | 10 6 | 12 7 | 1 8 | 8 9 | 27 10 | 64 11 | 125 12 | 216 13 | Tuple[Static[Vector[Int32]], Static[double]] 14 | -------------------------------------------------------------------------------- /test/lang/uncategorized/16/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | enum Kind ( 4 | GOOD, 5 | BAD, 6 | UGLY, 7 | ); 8 | 9 | main() { 10 | var a, b, = UGLY, BAD, ; 11 | var c = a > b; 12 | var d = a == b; 13 | var y = Int32(a); 14 | var z = Kind(y); 15 | println("c=", Int32(c), ", d=", Int32(d), ", y=", y); 16 | } 17 | -------------------------------------------------------------------------------- /test/lang/uncategorized/16/out.txt: -------------------------------------------------------------------------------- 1 | c=1, d=0, y=2 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/17/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | var sum = 1000; 4 | 5 | main() { 6 | for (x in range(10)) 7 | sum +: x+1; 8 | println("sum = ", sum); 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/uncategorized/17/out.txt: -------------------------------------------------------------------------------- 1 | sum = 1055 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/18/out.txt: -------------------------------------------------------------------------------- 1 | a[0], a[2] = 200, 196 2 | compare test = 1 3 | compare test = 0 4 | compare test = -1 5 | a[0], a[2] = 2, 6 6 | -------------------------------------------------------------------------------- /test/lang/uncategorized/19/out.txt: -------------------------------------------------------------------------------- 1 | x = 0 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/2/out.txt: -------------------------------------------------------------------------------- 1 | -20 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/20/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | var x = 10; 4 | 5 | alias Y = x; 6 | 7 | alias P = println; 8 | 9 | main() { 10 | inc(Y); 11 | P("Hello World ", x); 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/uncategorized/20/out.txt: -------------------------------------------------------------------------------- 1 | Hello World 11 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/21/out.txt: -------------------------------------------------------------------------------- 1 | constructed value = 10 2 | constructed value = 0 3 | assigning 4 | destroyed value = 0 5 | assigned 6 | destroyed value = 10 7 | -------------------------------------------------------------------------------- /test/lang/uncategorized/22/out.txt: -------------------------------------------------------------------------------- 1 | RValue?(foo1()) = 1 2 | RValue?(foo2()) = 0 3 | -------------------------------------------------------------------------------- /test/lang/uncategorized/24/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | define printAll; 4 | 5 | overload printAll(a:Int, ..rest) { 6 | println(a); 7 | printAll(..rest); 8 | } 9 | 10 | overload printAll() { 11 | } 12 | 13 | main() { 14 | printAll(1, 2, 3, 4, 5); 15 | } 16 | -------------------------------------------------------------------------------- /test/lang/uncategorized/24/out.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | -------------------------------------------------------------------------------- /test/lang/uncategorized/33/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import sharedpointers.*; 3 | 4 | main() { 5 | var p = new([10, true]); 6 | println(Type(p)); // prints "SharedPointer[Tuple[Int32,Bool]]" 7 | } 8 | -------------------------------------------------------------------------------- /test/lang/uncategorized/33/out.txt: -------------------------------------------------------------------------------- 1 | SharedPointer[Tuple[Int32, Bool]] 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/34/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | record Foo (); 3 | 4 | overload Foo() --> returned:Foo { println("constructing Foo"); } 5 | overload destroy(x:Foo) { println("destroying Foo"); } 6 | 7 | var foo = Foo(); 8 | 9 | main() { 10 | foo; 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/uncategorized/34/out.txt: -------------------------------------------------------------------------------- 1 | constructing Foo 2 | destroying Foo 3 | -------------------------------------------------------------------------------- /test/lang/uncategorized/39/out.txt: -------------------------------------------------------------------------------- 1 | This is line 1 2 | This is line 2 3 | I am line no. 3 4 | I am line number 4 5 | Test me 6 | This is line 1 7 | This is line 2 8 | I am line no. 3 9 | I am line number 4 10 | Test me 11 | -------------------------------------------------------------------------------- /test/lang/uncategorized/39/test.txt: -------------------------------------------------------------------------------- 1 | This is line 1 2 | This is line 2 3 | I am line no. 3 4 | I am line number 4 5 | Test me 6 | -------------------------------------------------------------------------------- /test/lang/uncategorized/4/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | var sum = 0; 5 | for (i in array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) 6 | sum +: i; 7 | println("sum = ", sum+Int(' ')); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/uncategorized/4/out.txt: -------------------------------------------------------------------------------- 1 | sum = 87 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/40/out.txt: -------------------------------------------------------------------------------- 1 | foo-10bar 2 | foo-20bar 3 | foo-30bar 4 | -------------------------------------------------------------------------------- /test/lang/uncategorized/42/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | swap(a, b) { return b, a; } 3 | 4 | [T] foo(#T) = T, Pointer[T]; 5 | 6 | main() { 7 | var a, b = ..swap(10, 20); 8 | println(a, ", ", b); 9 | a, b = b, a; 10 | println(a, ", ", b); 11 | 12 | var P, Q = ..foo(Int32); 13 | println(P, ", ", Q); 14 | } 15 | -------------------------------------------------------------------------------- /test/lang/uncategorized/42/out.txt: -------------------------------------------------------------------------------- 1 | 20, 10 2 | 10, 20 3 | Int32, Pointer[Int32] 4 | -------------------------------------------------------------------------------- /test/lang/uncategorized/44/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | define wrap; 4 | overload wrap(rvalue first, forward ..rest) = first, ..wrap(..rest); 5 | overload wrap(ref first, forward ..rest) = @first, ..wrap(..rest); 6 | overload wrap() = ; 7 | 8 | main() { 9 | var x = 10; 10 | var a = [..wrap(10, x, 10, x)]; 11 | println(Type(a)); 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/uncategorized/44/out.txt: -------------------------------------------------------------------------------- 1 | Tuple[Int32, Pointer[Int32], Int32, Pointer[Int32]] 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/45/out.txt: -------------------------------------------------------------------------------- 1 | PtrTuple[Static["foo"], Static["bar"], Int32] 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/46/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | fields(I) = ["x", I], ["y", I]; 4 | 5 | record Point[I] = ..fields(I); 6 | 7 | [I] overload Point(x:I, y:I) = Point[I](x, y); 8 | 9 | main() { 10 | var a = Point(10, 20); 11 | println(Type(a)); 12 | println(a.x, ", ", a.y); 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/uncategorized/46/out.txt: -------------------------------------------------------------------------------- 1 | Point[Int32] 2 | 10, 20 3 | -------------------------------------------------------------------------------- /test/lang/uncategorized/5/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | define foo; 4 | 5 | overload foo(x) = 0; 6 | overload foo(x:Bool) = 1; 7 | overload foo(x:Int32) = 2; 8 | 9 | main() { 10 | var v = true; 11 | println(foo(v) + 10*foo(true) + 100*foo(10)); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/uncategorized/5/out.txt: -------------------------------------------------------------------------------- 1 | 211 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/6/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | var sum = 0; 5 | for (c in "Hello World!") 6 | sum +: Int32(c); 7 | println("sum = ", sum); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/uncategorized/6/out.txt: -------------------------------------------------------------------------------- 1 | sum = 1085 2 | -------------------------------------------------------------------------------- /test/lang/uncategorized/7/main.unix.clay: -------------------------------------------------------------------------------- 1 | import libc; 2 | 3 | main() { 4 | var s = "Hello World!\n"; 5 | 6 | libc.fwrite(RawPointer(cstring(s)), SizeT(1), size(s), libc.stdout); 7 | 8 | var f = libc.fdopen(1, cstring("w")); 9 | libc.fwrite(RawPointer(cstring(s)), SizeT(1), size(s), f); 10 | } 11 | -------------------------------------------------------------------------------- /test/lang/uncategorized/7/out.txt: -------------------------------------------------------------------------------- 1 | Hello World! 2 | Hello World! 3 | -------------------------------------------------------------------------------- /test/lang/uncategorized/8/out.txt: -------------------------------------------------------------------------------- 1 | a[0], a[2] = 200, 196 2 | compare test = 1 3 | compare test = 0 4 | compare test = -1 5 | a[0], a[2] = 2, 6 6 | -------------------------------------------------------------------------------- /test/lang/uncategorized/9/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import data.vectors.*; 3 | 4 | main() { 5 | var v = vector(1, 2, 3, 4, 5); 6 | var sum = 0; 7 | for (x in v) 8 | sum +: x; 9 | println(sum); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/lang/uncategorized/9/out.txt: -------------------------------------------------------------------------------- 1 | 15 2 | -------------------------------------------------------------------------------- /test/lang/unions/out.txt: -------------------------------------------------------------------------------- 1 | sizeof union = 8 2 | as Double = 1 3 | as UInt64 = 4607182418800017408 4 | as Array[UInt8,8] = 0 0 0 0 0 0 240 63 5 | as Point = Point(0, 1072693248) 6 | -------------------------------------------------------------------------------- /test/lang/variants/1/out.txt: -------------------------------------------------------------------------------- 1 | Circle(10.1) 2 | Square(20.2) 3 | -------------------------------------------------------------------------------- /test/lang/variants/2/out.txt: -------------------------------------------------------------------------------- 1 | Circle(10.1) 2 | Square(20.2) 3 | -------------------------------------------------------------------------------- /test/lang/variants/3/out.txt: -------------------------------------------------------------------------------- 1 | Human, Human 2 | Human, Dog 3 | Dog, Human 4 | Dog, Dog 5 | -------------------------------------------------------------------------------- /test/lang/variants/4/out.txt: -------------------------------------------------------------------------------- 1 | Human, Human 2 | Human, Dog 3 | Human, Cat 4 | Dog, Human 5 | Dog, Dog 6 | Dog, Cat 7 | Cat, Human 8 | Cat, Dog 9 | Cat, Cat 10 | -------------------------------------------------------------------------------- /test/lang/variants/5/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | variant Variant[..T] (..T); 3 | 4 | foo(x:Variant[Int,Float]) { 5 | println(x); 6 | } 7 | 8 | main() { 9 | var x = Variant[Int, Float](5); 10 | var y = Variant[Int, Float](4.0f); 11 | foo(x); 12 | foo(y); 13 | } 14 | -------------------------------------------------------------------------------- /test/lang/variants/5/out.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 4 3 | -------------------------------------------------------------------------------- /test/lang/variants/closed/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | cannot add instances to closed variant 2 | -------------------------------------------------------------------------------- /test/lang/variants/closed/1/main.clay: -------------------------------------------------------------------------------- 1 | record Bar (); 2 | record Baz (); 3 | 4 | variant Foo (Bar); 5 | 6 | instance Foo (Baz); 7 | 8 | main() { 9 | } 10 | -------------------------------------------------------------------------------- /test/lang/variants/closed/empty/compilererr.txt: -------------------------------------------------------------------------------- 1 | cannot add instances to closed variant 2 | -------------------------------------------------------------------------------- /test/lang/variants/closed/empty/main.clay: -------------------------------------------------------------------------------- 1 | record Bar (); 2 | 3 | variant Foo (); 4 | 5 | instance Foo (Bar); 6 | 7 | main() { 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/variants/dispatch/callbyname/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | variant Foo (Int, Double); 3 | 4 | alias f(x) { println(__LINE__, ": ", x); } 5 | main() { 6 | f(*Foo(1)); 7 | f(*Foo(2.5)); 8 | } 9 | -------------------------------------------------------------------------------- /test/lang/variants/dispatch/callbyname/out.txt: -------------------------------------------------------------------------------- 1 | 6: 1 2 | 7: 2.5 3 | -------------------------------------------------------------------------------- /test/lang/variants/empty/compilererr.txt: -------------------------------------------------------------------------------- 1 | variant type must have at least one instance 2 | -------------------------------------------------------------------------------- /test/lang/variants/empty/main.clay: -------------------------------------------------------------------------------- 1 | variant Empty (); 2 | 3 | main() { 4 | uninitializedUnsafe(Empty); 5 | } 6 | -------------------------------------------------------------------------------- /test/lang/variants/equality/out.txt: -------------------------------------------------------------------------------- 1 | true false false true 2 | false true false false 3 | false false true false 4 | true false false true 5 | -------------------------------------------------------------------------------- /test/lang/variants/initialization/out.txt: -------------------------------------------------------------------------------- 1 | Banana() 2 | Nope! Bananas! 3 | Banana() 4 | Nope! Bananas! 5 | Banana() 6 | -------------------------------------------------------------------------------- /test/lang/variants/match/out.txt: -------------------------------------------------------------------------------- 1 | I saw an Int 2 2 | I saw a Double 3 3 | I saw a string four 4 | 5 | I saw an Int 2 6 | I saw a non-Int 3 7 | I saw a non-Int four 8 | -------------------------------------------------------------------------------- /test/lang/variants/nested/out.txt: -------------------------------------------------------------------------------- 1 | [[Literal, IntLiteral]] 2 | [] 3 | [[UnaryOp]] 4 | [[UnaryOp, Plus]] 5 | false 6 | true 7 | true 8 | false 9 | false 10 | true 11 | false 12 | true 13 | -------------------------------------------------------------------------------- /test/lang/variants/predicates/compilererr.txt: -------------------------------------------------------------------------------- 1 | predicate failed 2 | -------------------------------------------------------------------------------- /test/lang/variants/predicates/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | [T] variant Foo[T] (Int, T); 3 | 4 | [T when Integer?(T)] 5 | variant Bar[T] (Int, T); 6 | 7 | main() { 8 | println(Foo[Float](3.0f)); 9 | println(Bar[Float](3.0f)); 10 | } 11 | -------------------------------------------------------------------------------- /test/lang/variants/recursive/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import sharedpointers.*; 3 | 4 | record Foo ( x: SharedPointer[Bar], y: SharedPointer[Bar] ); 5 | variant Bar (Int, Foo); 6 | 7 | main() { 8 | var z = Foo(new(Bar(0)), new(Bar(0))); 9 | println(variantAs(z.x^, Int), ", ", variantAs(z.y^, Int)); 10 | } 11 | -------------------------------------------------------------------------------- /test/lang/variants/recursive/1/out.txt: -------------------------------------------------------------------------------- 1 | 0, 0 2 | -------------------------------------------------------------------------------- /test/lang/variants/recursive/2/main.clay: -------------------------------------------------------------------------------- 1 | // #228 2 | // thanks to freenode:maw 3 | import printer.(println); 4 | import data.vectors.*; 5 | 6 | variant Node (Tree, Int); 7 | record Tree (nodes : Vector[Node]); 8 | 9 | main() { 10 | var t = Tree(Vector[Node]()); 11 | println("ok"); 12 | } 13 | -------------------------------------------------------------------------------- /test/lang/variants/recursive/2/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lang/variants/subgraphassignment/out.txt: -------------------------------------------------------------------------------- 1 | Leaf(1) 2 | -------------------------------------------------------------------------------- /test/lang/variants/variantref/out.txt: -------------------------------------------------------------------------------- 1 | 2 2.5 3 3.5 2 | -------------------------------------------------------------------------------- /test/lib-clay/algorithms/count/main.clay: -------------------------------------------------------------------------------- 1 | import data.algorithms.(count); 2 | import printer.(println); 3 | import data.vectors.*; 4 | 5 | main() { 6 | var v = vector(1, 2, 3, 4, 5); 7 | println(count(a => a % 2 == 0, v)); 8 | println(count(a => a % 2 == 1, v)); 9 | } 10 | -------------------------------------------------------------------------------- /test/lib-clay/algorithms/count/out.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/casValue/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/casValue/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/casValue/out.txt: -------------------------------------------------------------------------------- 1 | 8000 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/normallyUnalignedType/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/normallyUnalignedType/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/normallyUnalignedType/out.txt: -------------------------------------------------------------------------------- 1 | {150, 150, 150} 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/normallyUnalignedType2/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/normallyUnalignedType2/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/normallyUnalignedType2/out.txt: -------------------------------------------------------------------------------- 1 | {200, 200, 200, 200} 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/rmw/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/rmw/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/atomics/rmw/out.txt: -------------------------------------------------------------------------------- 1 | 8000 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/corefoundation/buildflags.txt: -------------------------------------------------------------------------------- 1 | -framework CoreFoundation 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/corefoundation/out.txt: -------------------------------------------------------------------------------- 1 | 451 didn't start the fire 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/foundation/buildflags.txt: -------------------------------------------------------------------------------- 1 | -framework Cocoa 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/foundation/out.txt: -------------------------------------------------------------------------------- 1 | 451 didn't start the fire 2 | Wii didn't start the fire 3 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/objc/buildflags.txt: -------------------------------------------------------------------------------- 1 | -framework Cocoa 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/objc/internals/buildflags.txt: -------------------------------------------------------------------------------- 1 | -framework Cocoa 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/objc/internals/foo.clay: -------------------------------------------------------------------------------- 1 | import cocoa.objc.*; 2 | 3 | record FooClass = newClass(Void, InstanceVars(), ClassMethods(), InstanceMethods()); 4 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/objc/internals/zim/zang.clay: -------------------------------------------------------------------------------- 1 | import cocoa.objc.*; 2 | 3 | record ZangClass = newClass(Void, InstanceVars(), ClassMethods(), InstanceMethods()); 4 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/objc/out.txt: -------------------------------------------------------------------------------- 1 | 451 didn't start the fire 2 | Wii didn't start the fire 3 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/objc/subclassing/buildflags.txt: -------------------------------------------------------------------------------- 1 | -framework Cocoa 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/objc/subclassing/out.txt: -------------------------------------------------------------------------------- 1 | 451 didn't start the fire 2 | 451 didn't start the fire 3 | 451 didn't start the fire 4 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/runtime/buildflags.txt: -------------------------------------------------------------------------------- 1 | -framework Cocoa 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/runtime/out.txt: -------------------------------------------------------------------------------- 1 | 451 didn't start the fire 2 | -------------------------------------------------------------------------------- /test/lib-clay/cocoa/util/buildflags.txt: -------------------------------------------------------------------------------- 1 | -framework Cocoa 2 | -------------------------------------------------------------------------------- /test/lib-clay/commandline/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import data.sequences.*; 3 | 4 | main() { 5 | for (i, x in enumerated(commandLine())) 6 | println(i, ") ", x); 7 | println(size(commandLine())); 8 | } 9 | -------------------------------------------------------------------------------- /test/lib-clay/commandline/1/out.txt: -------------------------------------------------------------------------------- 1 | 0) ./test.exe 2 | 1) apples 3 | 2) bananas 4 | 3) orange soda 5 | 4 6 | -------------------------------------------------------------------------------- /test/lib-clay/commandline/1/out.windows.txt: -------------------------------------------------------------------------------- 1 | 0) .\test.exe 2 | 1) apples 3 | 2) bananas 4 | 3) orange soda 5 | 4 6 | -------------------------------------------------------------------------------- /test/lib-clay/commandline/1/run.py: -------------------------------------------------------------------------------- 1 | from subprocess import check_call, CalledProcessError 2 | from sys import argv 3 | 4 | try: 5 | check_call([argv[1], 'apples', 'bananas', 'orange soda']) 6 | except CalledProcessError as ex: 7 | print "!! error code", ex.returncode 8 | -------------------------------------------------------------------------------- /test/lib-clay/commandline/dispatch/err.txt: -------------------------------------------------------------------------------- 1 | Available commands: 2 | add add integers 3 | subtract subtract integers 4 | multiply multiply integers 5 | divide divide integers 6 | version 7 | Division by zero! 8 | -------------------------------------------------------------------------------- /test/lib-clay/commandline/dispatch/out.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 1 3 | 30 4 | 2 5 | dispatchr 2.0 BETA 6 | !! error code 2 7 | !! error code 1 8 | -------------------------------------------------------------------------------- /test/lib-clay/core/defaultvaluesemantics/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lib-clay/core/memory/allocateArray/out.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 0 5 | 0 6 | -- 7 | 0 8 | 1 9 | 2 10 | 3 11 | 4 12 | -------------------------------------------------------------------------------- /test/lib-clay/core/memory/allocateObject/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import lambdas.*; 3 | 4 | main() { 5 | var f = allocateObject( Function[[Int],[Int]](x => x + 10) ); 6 | for (x in range(10)) 7 | println(f^(x)); 8 | freeObject(f); 9 | } 10 | -------------------------------------------------------------------------------- /test/lib-clay/core/memory/allocateObject/out.txt: -------------------------------------------------------------------------------- 1 | 10 2 | 11 3 | 12 4 | 13 5 | 14 6 | 15 7 | 16 8 | 17 9 | 18 10 | 19 11 | -------------------------------------------------------------------------------- /test/lib-clay/core/memory/copy/out.txt: -------------------------------------------------------------------------------- 1 | after moveMemory up: 2 | NonPODInt(1) 3 | NonPODInt(2) 4 | NonPODInt(3) 5 | NonPODInt(4) 6 | NonPODInt(5) 7 | NonPODInt(6) 8 | NonPODInt(7) 9 | NonPODInt(7) 10 | after moveMemory down: 11 | NonPODInt(0) 12 | NonPODInt(0) 13 | NonPODInt(1) 14 | NonPODInt(2) 15 | NonPODInt(3) 16 | NonPODInt(4) 17 | NonPODInt(5) 18 | NonPODInt(6) 19 | -------------------------------------------------------------------------------- /test/lib-clay/core/memory/zeroObject/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | record Foo(x:Int, y:Int); 4 | 5 | main() { 6 | var foo = Foo(1111, 2222); 7 | zeroObject(foo); 8 | println(foo); 9 | } 10 | -------------------------------------------------------------------------------- /test/lib-clay/core/memory/zeroObject/out.txt: -------------------------------------------------------------------------------- 1 | Foo(0, 0) 2 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/conversion/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import numbers.parser.*; 3 | 4 | main(args) { 5 | var x = parse(Float, "1000"); // optimization barrier 6 | println(x, ' ', ULong(0.009f*x), ' ', 0.009f*x); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/conversion/out.txt: -------------------------------------------------------------------------------- 1 | 1000 9 9 2 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/literals/toolarge/compilererr.txt: -------------------------------------------------------------------------------- 1 | int32 literal out of range 2 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/literals/toolarge/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x = 0x8000_0000i; 3 | } 4 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/literals/toolarge2/compilererr.txt: -------------------------------------------------------------------------------- 1 | int64 literal out of range 2 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/literals/toolarge2/main.clay: -------------------------------------------------------------------------------- 1 | main() { 2 | var x = 0x8000_0000_0000_0000l; 3 | } 4 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/octal/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | println(0177); 5 | println(0199); 6 | println(octal("0177")); 7 | } 8 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/octal/out.txt: -------------------------------------------------------------------------------- 1 | 177 2 | 199 3 | 127 4 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/quotient/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | main(){ 3 | println(10 \ 2 \ 2); 4 | var a = 5; 5 | a \: 2; 6 | println(a); 7 | } 8 | -------------------------------------------------------------------------------- /test/lib-clay/core/numbers/quotient/out.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | -------------------------------------------------------------------------------- /test/lib-clay/core/platform/main.clay: -------------------------------------------------------------------------------- 1 | import core.platform.( 2 | OS, OSFamily, CPU, CPUFamily, 3 | OSString, OSFamilyString, CPUString, CPUBits, 4 | ); 5 | import printer.(println); 6 | 7 | main() { 8 | println("ok"); 9 | } 10 | -------------------------------------------------------------------------------- /test/lib-clay/core/platform/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lib-clay/data/any/out.txt: -------------------------------------------------------------------------------- 1 | Bool true 2 | Int 10 3 | Other 4 | -------------------------------------------------------------------------------- /test/lib-clay/data/deques/buildflags.txt: -------------------------------------------------------------------------------- 1 | -O1 2 | -------------------------------------------------------------------------------- /test/lib-clay/data/deques/memory/buildflags.txt: -------------------------------------------------------------------------------- 1 | -O1 2 | -------------------------------------------------------------------------------- /test/lib-clay/data/hashmaps/out.txt: -------------------------------------------------------------------------------- 1 | 1, 1 2 | 25, 5 3 | 49, 7 4 | 81, 9 5 | 9, 3 6 | 7 | 1, 1 8 | 25, 5 9 | 49, 7 10 | 81, 9 11 | 9, 3 12 | 13 | 1, 1 14 | 25, 5 15 | 49, 7 16 | 81, 9 17 | 9, 3 18 | 19 | 0 20 | -------------------------------------------------------------------------------- /test/lib-clay/data/hashmaps/rvalueiteration/out.txt: -------------------------------------------------------------------------------- 1 | 1 present 2 | 2 present 3 | 3 present 4 | 4 present 5 | 1 present 6 | 2 present 7 | 3 present 8 | 4 present 9 | -------------------------------------------------------------------------------- /test/lib-clay/data/hashmaps/valueinitialization/out.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 1234 4 | 1234 5 | {} 6 | {} 7 | {1234} 8 | {1234} 9 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/1/out.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 20 3 | 300 4 | 40 5 | 500 6 | 60 7 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/2/out.txt: -------------------------------------------------------------------------------- 1 | 12 2 | 16 3 | 20 4 | 24 5 | 28 6 | 32 7 | 0 8 | 2 9 | 4 10 | 6 11 | 8 12 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/4/out.txt: -------------------------------------------------------------------------------- 1 | 0) 10 2 | 1) 20 3 | 2) 40 4 | 3) 80 5 | 4) 160 6 | 55 7 | 4::3::2::1::0::Nil() 8 | evens: 90 9 | odds: 100 10 | 55 11 | 3628800 12 | 10, 2, 3, 4, 5, 6, 7, 8, 9, 1 13 | 1, 1, 2, 4, 7, 7, 7, 9, 15, 15, 19 14 | not found 10 15 | found 1 at 0 16 | found 19 at 10 17 | not found 10, range = [8, 8] 18 | found 1, range = [0, 2] 19 | found 19, range = [10, 11] 20 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/6/out.txt: -------------------------------------------------------------------------------- 1 | 0, 1, 2, 3, 4 2 | 5, 6, 7, 8, 9 3 | 9, 8, 7, 6, 5, 5, 6, 7, 8, 9 4 | 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37 5 | true 6 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/7/out.txt: -------------------------------------------------------------------------------- 1 | 0, 10, 2, 30, 4, 50, 6, 70, 8, 9 2 | 10, 19, 10, 37, 10, 55, 10, 73, 10, 10 3 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/arrayassignment/out.txt: -------------------------------------------------------------------------------- 1 | {7, 8, 9} 2 | {7, 8, 9} 3 | {10, 11, 12} 4 | {13, 14, 15} 5 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/buffervector/out.txt: -------------------------------------------------------------------------------- 1 | 11 2 | Hello World 3 | 11 4 | Hello World 5 | 6 6 | tata! 7 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/concatenation/out.txt: -------------------------------------------------------------------------------- 1 | hello world! 2 | abcde 3 | abcdefghijkl 4 | {1, 2, 3, 4, 5, 6} 5 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/force/out.txt: -------------------------------------------------------------------------------- 1 | Array[Int32, 5]: {0, 1, 2, 3, 4} 2 | Array[Int32, 5]: {12, 9, 6, 3, 0} 3 | Vector[Int32]: {12, 6, 0} 4 | Deque[Int32]: {36, 18, 0} 5 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/multivalued/out.txt: -------------------------------------------------------------------------------- 1 | {[0, 8], [1, 6], [2, 4], [3, 2], [4, 0]} 2 | {[0, 8], [1, 6], [2, 4], [3, 2], [4, 0]} 3 | {[0, 8], [1, 6], [2, 4], [3, 2], [4, 0]} 4 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/staticsized/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import data.sequences.*; 3 | 4 | main() { 5 | var a = integerArray(#5); 6 | println(a); 7 | 8 | var b = Array(reversed(mapped(x => 2*x, a))); 9 | println(b); 10 | 11 | var c = Array(mapped(add, zipped(a, b))); 12 | println(c); 13 | } 14 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/staticsized/out.txt: -------------------------------------------------------------------------------- 1 | {0, 1, 2, 3, 4} 2 | {8, 6, 4, 2, 0} 3 | {8, 7, 6, 5, 4} 4 | -------------------------------------------------------------------------------- /test/lib-clay/data/sequences/strict/out.txt: -------------------------------------------------------------------------------- 1 | Array[Int32, 5]: {0, 1, 2, 3, 4} 2 | Array[Int32, 5]: {12, 9, 6, 3, 0} 3 | Vector[Int32]: {12, 6, 0} 4 | Deque[Int32]: {36, 18, 0} 5 | -------------------------------------------------------------------------------- /test/lib-clay/data/strings/out.txt: -------------------------------------------------------------------------------- 1 | Hello, Dhruva! 2 | size = 3, str = Foo 3 | -------------------------------------------------------------------------------- /test/lib-clay/defaultarguments/main.clay: -------------------------------------------------------------------------------- 1 | import defaultarguments.*; 2 | import printer.(println); 3 | 4 | foo(..args) { 5 | var name, number = ..defaultArguments(["John Doe", 42], ..args); 6 | println(name, ": ", number); 7 | } 8 | 9 | main() { 10 | foo(); 11 | foo("Ford Prefect"); 12 | foo("John Romero", 666); 13 | } 14 | -------------------------------------------------------------------------------- /test/lib-clay/defaultarguments/out.txt: -------------------------------------------------------------------------------- 1 | John Doe: 42 2 | Ford Prefect: 42 3 | John Romero: 666 4 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/common/buildflags.txt: -------------------------------------------------------------------------------- 1 | -c 2 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/common/run.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.append('..') 3 | import external_test 4 | external_test.runExternalTest() 5 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/complex/buildflags.txt: -------------------------------------------------------------------------------- 1 | -c 2 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/complex/run.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.append('..') 3 | import external_test 4 | external_test.runExternalTest() 5 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/newtypes/buildflags.txt: -------------------------------------------------------------------------------- 1 | -c 2 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/newtypes/out.txt: -------------------------------------------------------------------------------- 1 | 101 2 | ReturnByReg(202) 3 | SingleFloat(303.5) 4 | MultiReg(404, 505.5) 5 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/newtypes/run.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.append('..') 3 | import external_test 4 | external_test.runExternalTest() 5 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/x86_float80/buildflags.txt: -------------------------------------------------------------------------------- 1 | -c 2 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/x86_float80/run.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.append('..') 3 | import external_test 4 | external_test.runExternalTest(["-mmmx","-msse","-msse2"]) 5 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/x86_sse/buildflags.txt: -------------------------------------------------------------------------------- 1 | -c 2 | -------------------------------------------------------------------------------- /test/lib-clay/externals/abi/x86_sse/run.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.append('..') 3 | import external_test 4 | external_test.runExternalTest(["-mmmx","-msse","-msse2"]) 5 | -------------------------------------------------------------------------------- /test/lib-clay/externals/ccast/out.txt: -------------------------------------------------------------------------------- 1 | {1, 2, 3} 2 | hello world 3 | @ 4 | -------------------------------------------------------------------------------- /test/lib-clay/externals/makeexternalcodepointer/out.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | 3 4 | 3 5 | 3 6 | 3 7 | -------------------------------------------------------------------------------- /test/lib-clay/externals/out.txt: -------------------------------------------------------------------------------- 1 | 25 2 | caught Error(buh) 3 | -------------------------------------------------------------------------------- /test/lib-clay/externals/recursiveccodepointer/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | alias FooFn = CCodePointer[[Foo],[]]; 4 | 5 | record Foo (x:FooFn); 6 | 7 | foo(f:Foo) { println("foo!"); } 8 | 9 | main() { 10 | var f = Foo(FooFn(foo)); 11 | 12 | f.x(f); 13 | } 14 | -------------------------------------------------------------------------------- /test/lib-clay/externals/recursiveccodepointer/out.txt: -------------------------------------------------------------------------------- 1 | foo! 2 | -------------------------------------------------------------------------------- /test/lib-clay/externals/recursivecodepointer/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | alias FooFn = CodePointer[[Foo],[]]; 4 | 5 | record Foo (x:FooFn); 6 | 7 | foo(f:Foo) { println("foo!"); } 8 | 9 | main() { 10 | var f = Foo(FooFn(foo)); 11 | 12 | f.x(f); 13 | } 14 | -------------------------------------------------------------------------------- /test/lib-clay/externals/recursivecodepointer/out.txt: -------------------------------------------------------------------------------- 1 | foo! 2 | -------------------------------------------------------------------------------- /test/lib-clay/hash/scalars/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lib-clay/hash/variants/main.clay: -------------------------------------------------------------------------------- 1 | // Ensure hash() for variants works and doesn't trap on expected overflows 2 | import hash.*; 3 | import printer.(println); 4 | 5 | variant A (Int32, Float64); 6 | 7 | main() { 8 | hash(A(4)); 9 | hash(A(4.0)); 10 | 11 | println("ok"); 12 | } 13 | -------------------------------------------------------------------------------- /test/lib-clay/hash/variants/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/constructors/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | constructor overload for type Foo must return a single value of that type 2 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/constructors/1/main.clay: -------------------------------------------------------------------------------- 1 | record Foo (); 2 | 3 | overload Foo() {} 4 | 5 | main() { var a = Foo(); } 6 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/constructors/2/compilererr.txt: -------------------------------------------------------------------------------- 1 | constructor overload for type Foo must return by value 2 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/constructors/2/main.clay: -------------------------------------------------------------------------------- 1 | record Foo (); 2 | 3 | overload Foo() { return ref null(Foo)^; } 4 | 5 | main() { var a = Foo(); } 6 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/constructors/3/compilererr.txt: -------------------------------------------------------------------------------- 1 | constructor overload for type Foo returns type Int32 2 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/constructors/3/main.clay: -------------------------------------------------------------------------------- 1 | record Foo (); 2 | 3 | overload Foo() { return 2; } 4 | 5 | main() { var a = Foo(); } 6 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/out.txt: -------------------------------------------------------------------------------- 1 | hello world size 11 2 | {1, 2, 3, 4} size 4 3 | {5, 6, 7} size 3 4 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/outputmismatch/1/compilererr.txt: -------------------------------------------------------------------------------- 1 | interface declares return type Float64, but overload returns type Int32 2 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/outputmismatch/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | [T] define foo(x:T) : T; 4 | 5 | overload foo(x) = Int(x); 6 | 7 | main() { 8 | println(foo(1.0)); 9 | } 10 | -------------------------------------------------------------------------------- /test/lib-clay/interfaces/outputmismatch/2/compilererr.txt: -------------------------------------------------------------------------------- 1 | interface declares return by reference, but overload returns by value 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/files/27/out.txt: -------------------------------------------------------------------------------- 1 | Creating.. 2 | Appending.. 3 | Reading.. 4 | 1) Hello World 5 | 2) Hello World! 6 | -------------------------------------------------------------------------------- /test/lib-clay/io/files/28/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import io.files.*; 3 | 4 | main() { 5 | var name = "test.txt"; 6 | var f = File(name); 7 | println(name, " is ", fileSize(f), " bytes."); 8 | } 9 | -------------------------------------------------------------------------------- /test/lib-clay/io/files/28/out.txt: -------------------------------------------------------------------------------- 1 | test.txt is 15 bytes. 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/files/28/test.txt: -------------------------------------------------------------------------------- 1 | This is a test. -------------------------------------------------------------------------------- /test/lib-clay/io/files/29/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lib-clay/io/files/29/out.txt -------------------------------------------------------------------------------- /test/lib-clay/io/filesystem/paths/test.clay: -------------------------------------------------------------------------------- 1 | 2 | import test.*; 3 | import platformspecific.*; 4 | 5 | main() = testMain(testSuite()); 6 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/addresses/buildflags.windows.txt: -------------------------------------------------------------------------------- 1 | -Wl,wsock32.lib 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/connections/buildflags.windows.txt: -------------------------------------------------------------------------------- 1 | -Wl,wsock32.lib 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/connections/out.txt: -------------------------------------------------------------------------------- 1 | -- client 1: address 2 | you connected from IP 127.0.0.1 3 | -- client 2: garbage 4 | unknown command garbage 5 | -- client 3: quit 6 | quitting 7 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/reading/buildflags.windows.txt: -------------------------------------------------------------------------------- 1 | -Wl,wsock32.lib 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/reading/out.txt: -------------------------------------------------------------------------------- 1 | expected 10 bytes. received 10 bytes. 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/reading/run.py: -------------------------------------------------------------------------------- 1 | from subprocess import Popen, PIPE; 2 | from sys import argv 3 | from time import sleep 4 | 5 | server = Popen([argv[1], "server"], stdout=PIPE); 6 | 7 | # wait for handshake from server before starting client 8 | hello = server.stdout.read(5); 9 | 10 | client = Popen([argv[1], "client"]); 11 | client.wait() 12 | 13 | server.wait() 14 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/valuesemantics/buildflags.windows.txt: -------------------------------------------------------------------------------- 1 | -Wl,wsock32.lib 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/valuesemantics/main.clay: -------------------------------------------------------------------------------- 1 | import io.sockets.*; 2 | import printer.(println); 3 | 4 | main() { 5 | startSockets(); 6 | 7 | var x = ListenSocket(Inet(INADDR_LOOPBACK, 1234)); 8 | 9 | var y = move(x); 10 | x = move(y); 11 | println("ok"); 12 | } 13 | -------------------------------------------------------------------------------- /test/lib-clay/io/sockets/valuesemantics/out.txt: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /test/lib-clay/io/temp/test.clay: -------------------------------------------------------------------------------- 1 | import io.temp.(tempDirectory); 2 | import io.filesystem.(pathExists?); 3 | 4 | import test.*; 5 | 6 | main() = testMain( 7 | TestSuite("io.temp", array( 8 | TestCase("tempDirectory", -> { 9 | expectTrue(pathExists?(tempDirectory())); 10 | }), 11 | ))); 12 | -------------------------------------------------------------------------------- /test/lib-clay/keywordarguments/out.txt: -------------------------------------------------------------------------------- 1 | 2 | x = 0 3 | zim = 1 4 | zang = two 5 | zung = 3 6 | 7 | x = 4 8 | zim = 5 9 | zang = six 10 | zung = 7 11 | 12 | x = 8 13 | zim = 9 14 | zang = six 15 | zung = 7 16 | 17 | x = 10 18 | zim = 5 19 | zang = eleven 20 | zung = 7 21 | 22 | x = 12 23 | zim = 5 24 | zang = six 25 | zung = 13 26 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | applier(f, x) { f(x); } 4 | 5 | alias adder(y) { 6 | applier(x -> { y +: x; }, 2); 7 | } 8 | 9 | main() { 10 | var y = 1; 11 | adder(y); 12 | println(y); 13 | } 14 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/1/out.txt: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/2/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | record R1(x:Int); 4 | 5 | main() { 6 | var r = R1(10); 7 | alias y = 20 + r.x; 8 | var f = () => { println(y); }; 9 | f(); 10 | } 11 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/2/out.txt: -------------------------------------------------------------------------------- 1 | 30 2 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/3/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | record R1(x:Int); 4 | 5 | main() { 6 | var r = R1(10); 7 | foo(20 + r.x); 8 | } 9 | 10 | alias foo(x) { 11 | var f = () => { println(x); }; 12 | f(); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/3/out.txt: -------------------------------------------------------------------------------- 1 | 30 2 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/vararg/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | applier(f, x) { f(x); } 4 | 5 | alias adder(..y) { 6 | applier(xin -> { (..y) +: xin; }, 2); 7 | } 8 | 9 | main() { 10 | var x, ..y = 1, 2; 11 | adder(x); 12 | adder(..y); 13 | println(x, ", ", ..y); 14 | } 15 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/alias/vararg/out.txt: -------------------------------------------------------------------------------- 1 | 3, 4 2 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/argsyntax/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | main() { 4 | println(((x:Int) -> x+x)(2)); 5 | } 6 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/argsyntax/out.txt: -------------------------------------------------------------------------------- 1 | 4 2 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/basic/out.txt: -------------------------------------------------------------------------------- 1 | 10 2 | first: 10, 20 3 | second: 10, 20 4 | 99, 100, 101 5 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/calldefined/out.txt: -------------------------------------------------------------------------------- 1 | false 2 | true 3 | false 4 | false 5 | true 6 | false 7 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/calloutputtypes/out.txt: -------------------------------------------------------------------------------- 1 | Int32, Bool 2 | Int32, Float32, Bool 3 | Int32, Float32, Char, Bool 4 | Int32, Bool 5 | Int32, Float32, Bool 6 | Int32, Float32, Char, Bool 7 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/dynamic/makelambda/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import lambdas.*; 3 | 4 | main() { 5 | var f = (..xs) -> (1, ..xs, true); 6 | println(Type(makeFunction(f))); 7 | println(Type(makeFunction(f, Int))); 8 | println(Type(makeFunction(f, Int8, Int16))); 9 | } 10 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/dynamic/makelambda/out.txt: -------------------------------------------------------------------------------- 1 | Function[[], [Int32, Bool]] 2 | Function[[Int32], [Int32, Int32, Bool]] 3 | Function[[Int8, Int16], [Int32, Int8, Int16, Bool]] 4 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/dynamic/out.txt: -------------------------------------------------------------------------------- 1 | 20 2 | 30 3 | 12 4 | 13 5 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/mono/out.txt: -------------------------------------------------------------------------------- 1 | mono: 2 | true 3 | true 4 | true 5 | true 6 | true 7 | true 8 | true 9 | true 10 | true 11 | true 12 | true 13 | not mono: 14 | false 15 | false 16 | false 17 | false 18 | false 19 | false 20 | false 21 | false 22 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/monoinputtypes/out.txt: -------------------------------------------------------------------------------- 1 | () -> () 2 | (Int32) -> (Int32, Int32) 3 | (Int32, Float32) -> (Float32) 4 | () -> () 5 | (Int32) -> () 6 | (Int32) -> (Int32, Float64) 7 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/nooutputtypes/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import lambdas.(Function); 3 | 4 | main() { 5 | var f = Function[[Int],[]](x -> { println(x); return x; }); 6 | f(219); 7 | } 8 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/nooutputtypes/out.txt: -------------------------------------------------------------------------------- 1 | 219 2 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/papply/out.txt: -------------------------------------------------------------------------------- 1 | 101 2 | 102 3 | 103 4 | 104 5 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/stateless/out.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | 4 6 | bye! 7 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/stateless2/compilererr.txt: -------------------------------------------------------------------------------- 1 | error: cannot capture free variable in stateless lambda function 2 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/stateless2/main.clay: -------------------------------------------------------------------------------- 1 | 2 | main() { 3 | var x = 1; 4 | var z = () ~> x + 8; 5 | z(); 6 | } 7 | -------------------------------------------------------------------------------- /test/lib-clay/lambdas/vararg/out.txt: -------------------------------------------------------------------------------- 1 | {30, 60, 90, 120} 2 | 1:47 3 | 2:58 4 | 3:69 5 | 33 6 | -------------------------------------------------------------------------------- /test/lib-clay/libc/setjmplongjmp/out.txt: -------------------------------------------------------------------------------- 1 | setjmp called 2 | before longjmp 3 | longjmp called. result = 10 4 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/1/out.txt: -------------------------------------------------------------------------------- 1 | 30 2 | 30 3 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/2/out.txt: -------------------------------------------------------------------------------- 1 | 30 Int32 2 | 50 UInt64 3 | 70 Int64 4 | 3.6 Float64 5 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/3/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | 3 | [x] 4 | foo(#x) --> returned:Int32 __llvm__ { 5 | store i32 $x, i32* %returned 6 | ret i8* null 7 | } 8 | 9 | [x] 10 | bar(#x) --> returned:Int32 __llvm__ { 11 | store $x, i32* %returned 12 | ret i8* null 13 | } 14 | 15 | main() { 16 | println(foo(#3)); 17 | println(bar("i32 4")); 18 | } 19 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/3/out.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 4 3 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/4/out.txt: -------------------------------------------------------------------------------- 1 | 16777216 2 | -1 3 | 10 4 | 1 5 | 0 6 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/intrinsics/nonexistent/compilererr.txt: -------------------------------------------------------------------------------- 1 | imported name not found 2 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/intrinsics/nonexistent/main.clay: -------------------------------------------------------------------------------- 1 | import __intrinsics__.(ventcore_frogblast); 2 | 3 | main() { println(ventcore_frogblast); } 4 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/intrinsics/out.txt: -------------------------------------------------------------------------------- 1 | ctlz 2 | __intrinsics__ 3 | 4 | UInt64 5 | UInt64 6 | UInt32 7 | UInt32 8 | UInt16 9 | UInt16 10 | UInt8 11 | UInt8 12 | 13 | 59 14 | 4 15 | 27 16 | 4 17 | 11 18 | 4 19 | 3 20 | 4 21 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/intrinsics/sse/1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import simd.*; 3 | import libc.(printf); 4 | import __intrinsics__.(x86_sse2_sqrt_pd as x86_sqrtpd); 5 | 6 | main() { 7 | println(x86_sqrtpd(Vec[Double,2](4.0))); 8 | } 9 | -------------------------------------------------------------------------------- /test/lib-clay/llvm/intrinsics/sse/1/out.txt: -------------------------------------------------------------------------------- 1 | Vec[Float64, 2](2, 2) 2 | -------------------------------------------------------------------------------- /test/lib-clay/math/libm/buildflags.txt: -------------------------------------------------------------------------------- 1 | -lm 2 | -------------------------------------------------------------------------------- /test/lib-clay/math/sqrt/buildflags.txt: -------------------------------------------------------------------------------- 1 | -lm 2 | -------------------------------------------------------------------------------- /test/lib-clay/math/sqrt/out.txt: -------------------------------------------------------------------------------- 1 | 0x1.000000p+1f 2 | 0x1.0000000000000p+1 3 | 0x0.000000p+0f+0x1.000000p+1fj 4 | 0x1.000000p+0f+0x1.000000p+0fj 5 | 0x0.0000000000000p+0+0x1.0000000000000p+1j 6 | 0x1.0000000000000p+0+0x1.0000000000000p+0j 7 | -------------------------------------------------------------------------------- /test/lib-clay/numbers/parser/float80/main.unix.x86.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import numbers.parser.*; 3 | import complex.*; 4 | 5 | main() { 6 | println(parse(Float80, "4.5")); 7 | println(parse(Imag80, "7.75")); 8 | } 9 | -------------------------------------------------------------------------------- /test/lib-clay/numbers/parser/float80/out.txt: -------------------------------------------------------------------------------- 1 | 4.5 2 | 7.75j 3 | -------------------------------------------------------------------------------- /test/lib-clay/paged/35/out.txt: -------------------------------------------------------------------------------- 1 | Hello World 2 | Hello World 3 | Hello World 4 | Hello World 5 | Hello World 6 | -------------------------------------------------------------------------------- /test/lib-clay/paged/36/out.txt: -------------------------------------------------------------------------------- 1 | Address(name=Foo, email=Bar, age=10) 2 | Address(name=Foo, email=Bar, age=20) 3 | Address(name=Foo, email=Bar, age=30) 4 | -------------------------------------------------------------------------------- /test/lib-clay/paged/37/main.clay: -------------------------------------------------------------------------------- 1 | import paged.*; 2 | import printer.(println); 3 | 4 | main() { 5 | initializePaging("temppaged.data", 100*1000); 6 | 7 | var count = NamedScalar[Int]("temp_count.data", 100); 8 | count^ +: 1; 9 | println("count = ", count^); 10 | } 11 | -------------------------------------------------------------------------------- /test/lib-clay/paged/37/out.txt: -------------------------------------------------------------------------------- 1 | count = 101 2 | -------------------------------------------------------------------------------- /test/lib-clay/paged/38/out.txt: -------------------------------------------------------------------------------- 1 | 0, 2 | -------------------------------------------------------------------------------- /test/lib-clay/parsing/calculator/out.txt: -------------------------------------------------------------------------------- 1 | 1+2*3 = 7 2 | 2*3+1 = 7 3 | -------------------------------------------------------------------------------- /test/lib-clay/parsing/calculator/run.py: -------------------------------------------------------------------------------- 1 | from subprocess import check_call, CalledProcessError 2 | from sys import argv 3 | 4 | try: 5 | check_call([argv[1], '1+2*3']) 6 | check_call([argv[1], '2*3+1']) 7 | except CalledProcessError as ex: 8 | print "!! error code", ex.returncode 9 | -------------------------------------------------------------------------------- /test/lib-clay/parsing/out.txt: -------------------------------------------------------------------------------- 1 | -1 = Nothing() (unparsed: '-1') 2 | 1 = 1 3 | 1+ = 1 (unparsed: '+') 4 | 1+2 = 3 5 | 1+2*3 = 7 6 | (1+2)*3 = 9 7 | -------------------------------------------------------------------------------- /test/lib-clay/printing/lambdas/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import printer.formatter.(repr); 3 | 4 | main() { 5 | var a = 2; 6 | 7 | println(x -> x); 8 | println(x -> x + a); 9 | println(x => x); 10 | println(x => x + a); 11 | println(repr(x -> x)); 12 | println(repr(x -> x + a)); 13 | println(repr(x => x)); 14 | println(repr(x => x + a)); 15 | } 16 | -------------------------------------------------------------------------------- /test/lib-clay/printing/lambdas/out.txt: -------------------------------------------------------------------------------- 1 | (x -> x) 2 | (x -> x + a) 3 | (x => x) 4 | (x => x + a) 5 | (x -> x) 6 | (x -> x + a) 7 | (x => x) 8 | (x => x + a) 9 | -------------------------------------------------------------------------------- /test/lib-clay/printing/nan/out.txt: -------------------------------------------------------------------------------- 1 | nan 2 | nan 3 | nan 4 | nan 5 | nan 6 | nan 7 | nan 8 | nan 9 | -------------------------------------------------------------------------------- /test/lib-clay/printing/observe/err.txt: -------------------------------------------------------------------------------- 1 | [observed: 2] 2 | [observed loneliestNumbers: 2, 1] 3 | [observed: lemons] 4 | [observed: lemons] 5 | [observed call +(1, 2).. 6 | ..returned 3] 7 | [observed call index({1, 2, 3}, 1).. 8 | ..returned 2] 9 | [observed call (x -> { throw x; })(AnException()).. 10 | ..threw AnException()] 11 | -------------------------------------------------------------------------------- /test/lib-clay/printing/observe/out.txt: -------------------------------------------------------------------------------- 1 | 3 2 | 3 3 | 4 4 | 5 5 | rvalue 6 | ref 7 | -------------------------------------------------------------------------------- /test/lib-clay/referencetypes/main.clay: -------------------------------------------------------------------------------- 1 | import referencetypes.*; 2 | import printer.(println); 3 | 4 | record Node[T] = referenceType( 5 | value:T, 6 | next:Node[T], 7 | ); 8 | 9 | main() { 10 | var a = Node[Int](); 11 | println(null?(a)); 12 | var b = Node[Int](10, a); 13 | println(null?(b)); 14 | println(a); 15 | println(b); 16 | } 17 | -------------------------------------------------------------------------------- /test/lib-clay/referencetypes/out.txt: -------------------------------------------------------------------------------- 1 | true 2 | false 3 | null 4 | Node[Int32](10, null) 5 | -------------------------------------------------------------------------------- /test/lib-clay/remote/messages/simple/out.txt: -------------------------------------------------------------------------------- 1 | -- server stderr 2 | Hello from Server! 3 | Hello from Lambda! 4 | arguments from client: 5 | * zim 6 | * zang 7 | * zung 8 | -- client stderr 9 | 10 | -------------------------------------------------------------------------------- /test/lib-clay/simd/invalidtypes/compilererr.txt: -------------------------------------------------------------------------------- 1 | Vec element type must be an integer or float type 2 | -------------------------------------------------------------------------------- /test/lib-clay/simd/invalidtypes/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import simd.*; 3 | 4 | main() { 5 | var x = Vec[Char, 16](); 6 | println(x); 7 | } 8 | -------------------------------------------------------------------------------- /test/lib-clay/simd/optimizationbug1/main.clay: -------------------------------------------------------------------------------- 1 | import printer.(println); 2 | import simd.*; 3 | 4 | main() { 5 | var a = Vec[Byte, 16](1uss); 6 | for (i in range(8)) { println(a); a = a+a; } 7 | } 8 | -------------------------------------------------------------------------------- /test/lib-clay/threads/condvars/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/condvars/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/condvars/out.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 2 4 | 3 5 | 4 6 | 5 7 | 6 8 | 7 9 | 8 10 | 9 11 | -------------------------------------------------------------------------------- /test/lib-clay/threads/core/simple/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/core/simple/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/core/simple/main.clay: -------------------------------------------------------------------------------- 1 | import printer.*; 2 | import threads.core.*; 3 | 4 | main() { 5 | var x = 12; 6 | var t = startThread(=> { println(x + 13); }); 7 | } 8 | -------------------------------------------------------------------------------- /test/lib-clay/threads/core/simple/out.txt: -------------------------------------------------------------------------------- 1 | 25 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/future/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/future/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/locks/mutex/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/locks/mutex/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/locks/mutex/out.txt: -------------------------------------------------------------------------------- 1 | 8000 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/locks/spinlock/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/locks/spinlock/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/locks/spinlock/out.txt: -------------------------------------------------------------------------------- 1 | 8000 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/threadlocal/buildflags.freebsd.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/threadlocal/buildflags.linux.txt: -------------------------------------------------------------------------------- 1 | -lpthread 2 | -------------------------------------------------------------------------------- /test/lib-clay/threads/threadlocal/out.txt: -------------------------------------------------------------------------------- 1 | 100 2 | 100 3 | 100 4 | 100 5 | 100 6 | 100 7 | 100 8 | 100 9 | -------------------------------------------------------------------------------- /test/lib-clay/time/main.clay: -------------------------------------------------------------------------------- 1 | import time; 2 | 3 | main() { 4 | time.sleep(0.1); 5 | } 6 | -------------------------------------------------------------------------------- /test/lib-clay/time/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lib-clay/time/out.txt -------------------------------------------------------------------------------- /test/lib-clay/twohash/out.txt: -------------------------------------------------------------------------------- 1 | 100000 2 | 4 3 | 999 4 | 99999 5 | 0 6 | -------------------------------------------------------------------------------- /test/lib-clay/uniquepointers/out.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jckarter/clay/db0bd2702ab0b6e48965cd85f8859bbd5f60e48e/test/lib-clay/uniquepointers/out.txt -------------------------------------------------------------------------------- /test/regression/279/compilererr.txt: -------------------------------------------------------------------------------- 1 | main\.clay\(2,27\): error: expected 2 values, but received 1 value 2 | -------------------------------------------------------------------------------- /test/regression/279/main.clay: -------------------------------------------------------------------------------- 1 | import data.strings.*; 2 | main(argc: Int, argv: Array[String]) {} 3 | --------------------------------------------------------------------------------