ã¡ãã£ã¨åã«ãã®ãã¡ã½ã¼ã¹å ¬éãããã¨è¨ããã¦ãã The V Programming Language ã GitHub ããåå¾ã§ããããã«ãªãã¾ããã
ã¨ããããã§ãã¤ãã©ãã cygwin ã§åããã¦ã¿ã¾ãã
ããã¾ã§ãè¨äºå·çæ 2019/06/27 æç¹ã§ã®æ å ±ã§ããvlang ã¯äºååç¥ããã£ãå½±é¿ã commit ãã¬ã³ã¬ã³ããã¦ãããããææ°ã®ç°å¢ã§ã¯å½¹ã«ç«ããªããããããªããã¨ã«æ³¨æãã¦ãã ããã
æå ã«æã£ã¦ããããmac ã linux ã§åããã¾ã§ã¯ä»ã®ç´¹ä»è¨äºãã°ã°ã£ããåºã¦ããã®ã§ãããããåèã«ãã¦ãã ããã
cygwin ã§åããã«ã¯æåã« v.c ã«æãå ¥ããå¿ è¦ãããã¾ãã
$ pwd /path/to/v/compiler $ make v.c curl -Os https://raw.githubusercontent.com/vlang/vc/master/v.c
ãã®ã¾ã¾ã³ã³ãã¤ã«ã¯ã§ããã®ã§ããããã®ã³ã³ãã¤ã©ã使ã£ã¦ v è¨èªã§æ¸ãããã½ã¼ã¹ãã³ã³ãã¤ã«ãããã¨ããã¨ã§ããªãã§ãã
$ gcc v.c -o vc.exe # æ»ã¬ã»ã©è¦åãåºã $ file vc.exe vc.exe: PE32+ executable (console) x86-64, for MS Windows $ ./vc.exe version V 0.1.4 $ ./vc.exe -o v.exe . cc: warning: '-x objective-c' after last input file has no effect cc: error: unrecognized command line option '-mmacosx-version-min=10.7' V panic: clang error
åå 㯠v.c ãããã©ã«ã㧠mac ã§ã®æåãæ³å®ãã¦ããããã§ãmac ã§ããèªèããªãã³ã³ãã¤ã©ãªãã·ã§ã³ãä»ä¸ããããã§ãã
v.c ã«ã¯ -os ã¨ããã¿ã¼ã²ãããåãæ¿ãããªãã·ã§ã³ãããã®ã§ãããç¾å¨ã¯ mac, linux, windows ããåãä»ããªã & çµå±ã©ããæå®ãã¦ãä½ãããã®ã¨ã©ã¼ã¨ãªãã¾ãã
ã¨ããããã§è«¦ã㦠v.c ã触ãã¾ãã
触ããã¤ã³ã㯠new_v ã¨ããé¢æ°ã§ããã㧠os ãã»ãããã¦ãããããã®å¤ã -1 ã®ãããªå®ç¾©æ¸ã¿ã® OS ã表ç¾ããå¤ä»¥å¤ãã»ãããã¾ãã
if (string_eq(dir, tos2(".")) && string_eq(out_name, tos2("a.out"))) { /*if*/ string base = string_all_after(os__getwd(), tos2("/")); out_name = string_trim_space(base); }; Os _os = MAC; // â ã³ã³ã -1 ã¨ãã«å¤ãã if (string_eq(target_os, tos2(""))) { /*if*/ #ifdef __linux__ _os = LINUX; #endif
ãããããã㨠vc.exe ã (ã¨ããããã¯) åãããã«ãªãã¾ãããã㧠v è¨èªã§æ¸ãããæ¹ã®ã³ã³ãã¤ã©ããã«ããã¾ãã
$ ./vc.exe -o v.exe . $ file ./v.exe ./v.exe: PE32+ executable (console) x86-64, for MS Windows $ ./v.exe version V 0.1.4 $ ./v.exe V 0.1.4 Use Ctrl-D to exit For now you have to use println() to print values, this will be fixed soon >>> println('Hello!') cc: warning: '-x objective-c' after last input file has no effect cc: error: unrecognized command line option '-mmacosx-version-min=10.7' V panic: clang error
åãä¿®æ£ãä»åº¦ã¯ main.v ã«å ããªããã°ãªãã¾ããã
ä»åº¦ã¯ãã¡ã㨠cygwin ã os ã®ãªã¹ãã«å ããä¿®æ£ã«ãã¾ãã
diff --git a/compiler/main.v b/compiler/main.v index b09e2e8..d80c7be 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -29,7 +29,7 @@ fn vtmp_path() string { } const ( - SupportedPlatforms = ['windows', 'mac', 'linux'] + SupportedPlatforms = ['windows', 'mac', 'linux', 'cygwin'] TmpPath = vtmp_path() ) @@ -37,6 +37,7 @@ enum Os { MAC LINUX WINDOWS + CYGWIN } enum Pass { @@ -735,7 +736,7 @@ fn new_v(args[]string) *V { base := os.getwd().all_after('/') out_name = base.trim_space() } - mut _os := MAC + mut _os := CYGWIN // No OS specifed? Use current system if target_os == '' { $if linux { @@ -753,6 +754,7 @@ fn new_v(args[]string) *V { case 'linux': _os = LINUX case 'windows': _os = WINDOWS case 'mac': _os = MAC + case 'cygwin': _os = CYGWIN } } builtins := [
$ ./v.exe V 0.1.4 Use Ctrl-D to exit For now you have to use println() to print values, this will be fixed soon >>> println('Hello!') Hello!
ããã§ç°¡å㪠v è¨èªã®ã³ã¼ããªãã³ã³ãã¤ã«ã§ããã¨æãã¾ãã
ã¡ãªã¿ã«ä¸è¨ã®æ¨ã® PR ãåºãã¦ã¿ãã®ã§ãããè¤éã«ãªããããã以ä¸ãã©ãããã©ã¼ã ãå¢ããã®ã¯ããã¾ãæ°ä¹ãããªãã¨ããåçã§ããã
ãããã«ä»ã® works for me æããã³ã¼ãã ã¨å¯¾å¿ãå ¥ããç®æãå¢ãã¦å¾®å¦ã¨ããã®ã¯ãããæ°ããã¾ãã
ä»å¾ãã³ã¼ããæ´çããã¦ãã£ããã対å¿ã容æã«ãªããããããªãã®ã§ãã¡ãã£ã¨ããã¾ã§å¾ ã¤ãã¨ã«ãã¦ã¿ã¾ãã