== Command Line == Quick examples: {{{ # compile and run immediately (if no errors) cobra myprog.cobra # get help cobra -h # compile only cobra -c myprog.cobra # with debug cobra -d -c myprog.cobra # multiple source files cobra -c foo.cobra bar.cobra # passing arguments cobra foo.cobra bar.cobra -- arg1 arg2 # disable all checks, contracts, asserts, etc. # maximum performance cobra -turbo foo.cobra }}} Getting help: {{{ cobra -h cobra -help }}} will dump a page detailing all the command line options supported. The compiler runs for each invocation in a particular mode of operation. These correspond to the 'commands on paths' * -compile ''or'' -c - compile the provided files and bind into an executable * -run-exe ''or'' -r - as for -compile but run the executable after successful compilation. This is the default mode if none other is given * -test - as for -compile but run the executables test cases after successful execution * -document - parse the provided files and generate documentation from the parse tree In addition there are three standalone commands * -help ''or'' -h - display the cobra commandline options and descriptions * -about - display info about cobra * -version - display the cobra executables version information Commandline items that are not options ( begin with '-') are taken to be filenames. Cobra can take one or a list of commandline given files to compile and the files can be cobra code ( filename ends in '.cobra') or C# code ( filename ends in '.cs'). Filenames without any extension are assumed to be a cobra code file of the same name with a '.cobra' extension i.e {{{ cobra myProg.cobra cobra myProg }}} both do the same thing - compile a cobra code file myProg.cobra to an executable and run it (if compilation succeeds) == Options == options form : -option:value, synonyms passing reference to an assembly be it .exe or .dll[[BR]] is done through -ref: it can take either of the two[[BR]] a) assemblyFileName.exe or assemblyFileName.dll[[BR]] b) itsFullPath\assemblyFileName.exe or itsFullPath\assemblyFileName.dll[[BR]] cobra -c -ref:anyAssembly.dll codeFile.cobra[[BR]] or [[BR]] cobra -c -ref:anyAssembly.exe codeFile.cobra[[BR]] with Full Paths[[BR]] cobra -c -ref:itsFullPath\anyValidAssembly.dll codeFile.cobra[[BR]] or [[BR]] cobra -c -ref:itsFullPath\anyValidAssembly.exe codeFile.cobra[[BR]] if you are not providing paths of the referenced assemblies then you can use[[BR]] -lib: option to provided additional paths for compiler to search for the referenced assemblies[[BR]] this can work good for assemblies outside of the GAC i.e private assemblies[[BR]] but suppose you want to include System.Speech which is found in both .net 3.5[[BR]] and .net 4.0 so even if you provide additional paths through -lib: for System.Speech[[BR]] if compiler is compiled on .net 4.0 it may default to using .net 4.0 version of System.Speech[[BR]] so when you want to specify paths to the referenced assembly explicitly[[BR]] use -ref:withFullPath\to\requiredAssembly.dll or .exe[[BR]] TODO Sections * Files:file * Controlling type of executable built -target/-t * Providing references and library search path -reference/-ref -library-directory/-lib -embed-run-time/-ert * Controlling compilation -include-{asserts, nil-checks, tests} * -optimize/-o -debug/-d -turbo/-t * -keep-intermediate-files/-kif * -contracts -verbosity/-v * Specifying executable and args for it -run-args/-- and -run * Error handling -detailed-stack-trace/dst -debugging-tips -exception-report -reveal-internal-exceptions * Development cycle - colorize -editor * Back end -sharp-compiler -sharp-args == Examples == == Working with Multiple Files == For now, see: * [http://cobra-language.com/forums/viewtopic.php?f=4&t=194 discussion: multiple files] * [http://cobra-language.com/forums/viewtopic.php?f=4&t=197 discussion: Importing Cobra Files] See also: MsxBuild, LanguageTopics, LibraryTopics