├── Build ├── RunCpp.bat ├── build_Worker.hxml ├── RunJava.bat ├── Test_Debug.bat ├── RunCs.bat ├── RunPy.bat ├── Run.bat ├── buildww.bat ├── BuildPy.bat ├── _forGL_BUILD_READ_ME.txt ├── CleanAll.bat ├── forGL_BUILD_READ_ME.txt ├── buildcs.bat ├── RunAll.bat └── Build.bat ├── Docs ├── forGL_Glossary.doc ├── forGL_Prototype_Notes.doc ├── forGL_Functional_Diagram.doc ├── forGL_Glossary_Technical.doc ├── forGL_High_Level_Design.doc ├── Presentations │ ├── forGL_at_Haxe_US_2019.pdf │ ├── src │ │ ├── forGL_at_Haxe_US_2019.odp │ │ └── forGL_Docs_Presentations_Src.txt │ └── HTML │ │ └── forGL_at_Haxe_US_2019 │ │ ├── home.png │ │ ├── img0.png │ │ ├── img1.png │ │ ├── img2.png │ │ ├── img3.png │ │ ├── img4.png │ │ ├── img5.png │ │ ├── img6.png │ │ ├── img7.png │ │ ├── img8.png │ │ ├── img9.png │ │ ├── last.png │ │ ├── left.png │ │ ├── text.png │ │ ├── first.png │ │ ├── img10.png │ │ ├── img11.png │ │ ├── img12.png │ │ ├── img13.png │ │ ├── img14.png │ │ ├── img15.png │ │ ├── img16.png │ │ ├── img17.png │ │ ├── img18.png │ │ ├── img19.png │ │ ├── right.png │ │ ├── first-inactive.png │ │ ├── last-inactive.png │ │ ├── left-inactive.png │ │ ├── right-inactive.png │ │ ├── img0.html │ │ ├── img19.html │ │ ├── img1.html │ │ ├── img2.html │ │ ├── img3.html │ │ ├── img4.html │ │ ├── img5.html │ │ ├── img6.html │ │ ├── img7.html │ │ ├── img8.html │ │ ├── img9.html │ │ ├── img10.html │ │ ├── img11.html │ │ ├── img12.html │ │ ├── img13.html │ │ ├── img14.html │ │ ├── img15.html │ │ ├── img16.html │ │ ├── img17.html │ │ ├── img18.html │ │ ├── text2.html │ │ ├── text0.html │ │ ├── text7.html │ │ ├── text19.html │ │ ├── text15.html │ │ ├── text18.html │ │ ├── text8.html │ │ ├── text3.html │ │ ├── text9.html │ │ ├── text12.html │ │ ├── text14.html │ │ ├── text16.html │ │ ├── text1.html │ │ ├── text4.html │ │ ├── text13.html │ │ ├── text6.html │ │ ├── text5.html │ │ ├── text11.html │ │ ├── text17.html │ │ ├── text10.html │ │ └── forGL_at_Haxe_US_2019.htm ├── Maintainers │ ├── forGL_To_Do_2019_April.txt │ ├── References_Natural Languages.txt │ ├── Dictionary As Application.txt │ ├── Software_Karaoke__forGL__Question.txt │ ├── References_Programming Languages & Browsers.txt │ ├── Haxe Multi Target Language Page.txt │ ├── Syntax Ideas and Programming Paradigms.txt │ └── forGL_References.txt └── _forGL_Docs_Read_Me_First.txt ├── Applications ├── Java │ ├── forGL.jar │ └── RunJava.bat ├── Python │ └── RunPy.bat ├── Browser │ ├── UI.bat │ ├── forGL_Browser_READ_ME.txt │ └── index_forGL.html └── forGL_as_Application_READ_ME.txt ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── src └── forGL │ ├── FileTypes.hx │ ├── js │ └── forGL_Load_Run.js │ ├── Export.hx │ ├── ExportAs.hx │ ├── data │ └── Data.hx │ ├── Comments.hx │ ├── NLImport.hx │ └── Meanings.hx ├── LICENSE.txt ├── CODE_OF_CONDUCT.md ├── _forGL_Getting_Started_READ_ME_NOW.txt ├── Tests └── forGL_Test.toml ├── Dictionaries ├── forGL_Test.toml └── forGL_Dictionary_Prototype.toml └── README.md /Build/RunCpp.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cd CppD_OUT 4 | Main-Debug.exe 5 | cd .. -------------------------------------------------------------------------------- /Docs/forGL_Glossary.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/forGL_Glossary.doc -------------------------------------------------------------------------------- /Applications/Java/forGL.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Applications/Java/forGL.jar -------------------------------------------------------------------------------- /Docs/forGL_Prototype_Notes.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/forGL_Prototype_Notes.doc -------------------------------------------------------------------------------- /Docs/forGL_Functional_Diagram.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/forGL_Functional_Diagram.doc -------------------------------------------------------------------------------- /Docs/forGL_Glossary_Technical.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/forGL_Glossary_Technical.doc -------------------------------------------------------------------------------- /Docs/forGL_High_Level_Design.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/forGL_High_Level_Design.doc -------------------------------------------------------------------------------- /Build/build_Worker.hxml: -------------------------------------------------------------------------------- 1 | -cp src 2 | -js ./JavaScript_OUT/forGL_WebWorker.js 3 | -lib haxe-strings 4 | -debug 5 | WebWorker -------------------------------------------------------------------------------- /Build/RunJava.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Run Java .jar 4 | cd Java_OUT 5 | java -jar Main.jar 6 | 7 | pause 8 | cd .. 9 | -------------------------------------------------------------------------------- /Docs/Presentations/forGL_at_Haxe_US_2019.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/forGL_at_Haxe_US_2019.pdf -------------------------------------------------------------------------------- /Applications/Java/RunJava.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | chcp 65001 4 | 5 | rem Run Java .jar 6 | 7 | java -jar forGL.jar 8 | 9 | 10 | -------------------------------------------------------------------------------- /Build/Test_Debug.bat: -------------------------------------------------------------------------------- 1 | rem Helper to use Debug build of CPP for test runs 2 | 3 | cd Cpp_OUT 4 | copy /Y Main-debug.exe Main.exe 5 | cd .. 6 | -------------------------------------------------------------------------------- /Build/RunCs.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Run C# .Exe 4 | cd CSharp_OUT/bin 5 | 6 | Main.exe 7 | 8 | pause 9 | 10 | cd .. 11 | cd .. -------------------------------------------------------------------------------- /Docs/Presentations/src/forGL_at_Haxe_US_2019.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/src/forGL_at_Haxe_US_2019.odp -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/home.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img0.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img1.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img2.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img3.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img4.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img5.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img6.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img7.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img8.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img9.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/last.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/last.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/left.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text.png -------------------------------------------------------------------------------- /Build/RunPy.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | chcp 65001 3 | 4 | rem Run Python .py 5 | 6 | 7 | cd Python_OUT 8 | 9 | python main.py 10 | 11 | 12 | 13 | cd .. -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/first.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img10.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img11.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img12.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img13.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img14.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img15.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img16.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img17.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img18.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img19.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/right.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/first-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/first-inactive.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/last-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/last-inactive.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/left-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/left-inactive.png -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/right-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RMax2015/forGL/HEAD/Docs/Presentations/HTML/forGL_at_Haxe_US_2019/right-inactive.png -------------------------------------------------------------------------------- /Build/Run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cd CPP_OUT 4 | if "%1"=="debug" ( 5 | :: run debug 6 | Main-Debug.exe 7 | ) else ( 8 | :: run release 9 | Main.exe 10 | ) 11 | 12 | 13 | cd .. -------------------------------------------------------------------------------- /Build/buildww.bat: -------------------------------------------------------------------------------- 1 | rem Build Haxe project to output various Programming Languages in different Directories 2 | 3 | rem JavaScript as forGL_WebWorker.js 4 | cd src 5 | copy /Y Main.hx WebWorker.hx 6 | cd.. 7 | haxe build_Worker.hxml -------------------------------------------------------------------------------- /Build/BuildPy.bat: -------------------------------------------------------------------------------- 1 | rem Build Haxe project to output various Programming Languages in different Directories 2 | 3 | 4 | rem Python as main.py 5 | haxe -lib haxe-strings -cp src -python ./Python_OUT/main.py -main Main 6 | 7 | cd Python_OUT 8 | copy /Y *.py .. 9 | cd .. -------------------------------------------------------------------------------- /Applications/Python/RunPy.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem UTF8 Code page on Windows, may not be needed otherwise 3 | chcp 65001 4 | 5 | rem Run: python forGL.py dictionary_file 6 | rem Please change dictionary_file below: to be actual name of your Dictionary file 7 | 8 | python forGL.py dictionary_file 9 | -------------------------------------------------------------------------------- /Build/_forGL_BUILD_READ_ME.txt: -------------------------------------------------------------------------------- 1 | forGL Build READ ME 2 | 3 | April 2019 4 | 5 | The Windows .bat files found here will work IF 6 | 7 | You copy these files up 1 level to the dir where the forGL GitHub repository was put on your system 8 | 9 | Easy enough to use these as an example to make your own shell scripts instead. 10 | 11 | -------------------------------------------------------------------------------- /Build/CleanAll.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo Cleaning out extra Files not needed to Run before Saving 4 | 5 | cd CPP_OUT 6 | rd /S /Q obj 7 | cd .. 8 | 9 | Rem No need to clean CSharp_OUT 10 | rem cd CSharp_OUT/bin 11 | 12 | cd Java_OUT 13 | rd /S /Q obj 14 | cd .. 15 | 16 | Rem No need to clean Python_OUT 17 | rem cd Python_OUT 18 | -------------------------------------------------------------------------------- /Build/forGL_BUILD_READ_ME.txt: -------------------------------------------------------------------------------- 1 | forGL Build READ ME 2 | 3 | April 2019 4 | 5 | The Windows .bat files found here will work IF 6 | 7 | You copy these files up 1 level to the dir where the forGL GitHub repository was put on your system 8 | 9 | 10 | 11 | You also need to create some empty directories : 12 | 13 | 14 | Easy enough to use these as an example to make your own shell scripts instead. 15 | 16 | 17 | 18 | Hope this helps! 19 | Randy Maxwell 20 | -------------------------------------------------------------------------------- /Applications/Browser/UI.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :AGAIN 4 | copy /Y ..\JavaScript_OUT\forGL_WebWorker.js 5 | copy /Y ..\JavaScript_OUT\forGL_WebWorker.js.map 6 | copy /Y ..\src\forGL\js\forGL_Load_Run.js 7 | 8 | rem "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" index_forGL.html 9 | "C:\Program Files\Mozilla Firefox\firefox.exe" index_forGL.html 10 | rem "C:\Program Files (x86)\Firefox Developer Edition\firefox.exe" index_forGL.html 11 | pause 12 | goto AGAIN -------------------------------------------------------------------------------- /Applications/Browser/forGL_Browser_READ_ME.txt: -------------------------------------------------------------------------------- 1 | forGL Browser READ ME 2 | 3 | April 2019 4 | 5 | This directory holds incomplete and buggy Web files that work with forGL. 6 | 7 | HTML Needs serious debugging 8 | 9 | After HTML is working, it needs to be moved to the src/js subdirectory 10 | 11 | I tried to get the Dictionary to load into the page to view only but not working yet. 12 | 13 | 14 | I think we can agree my HTML skills are lacking. 15 | 16 | Hope this helps! 17 | Randy Maxwell -------------------------------------------------------------------------------- /Build/buildcs.bat: -------------------------------------------------------------------------------- 1 | rem Build Haxe project to output various Programming Languages in different Directories 2 | 3 | rem C++ as Windows .Exe 32 bit 4 | haxe -lib haxe-strings -cp src -cpp ./Cpp_OUT -main Main 5 | 6 | rem C# as Windows .Exe 7 | haxe -lib haxe-strings -cp src -cs ./CSharp_OUT -main Main 8 | 9 | rem Java as Main.jar 10 | haxe -lib haxe-strings -cp src -java ./Java_OUT -main Main 11 | 12 | rem Python as main.py 13 | haxe -lib haxe-strings -cp src -python ./Python_OUT/main.py -main Main -------------------------------------------------------------------------------- /Docs/Presentations/src/forGL_Docs_Presentations_Src.txt: -------------------------------------------------------------------------------- 1 | forGL / docs / presentations / src directory Read Me 2 | 3 | 4 | Slide style presentation at Haxe US Summit May 2019 5 | Used a very simple format of Black background and White text. 6 | 7 | forGL_at_Haxe_US_2019.odp 8 | 9 | Created using Open Office (on Windows 10) 4.1.6 10 | 11 | This file is used to create 12 | forGL_at_Haxe_US_2019.ppt 13 | in the forGL / docs / presentations directory 14 | and 15 | in the forGL / docs / presentations / HTML / forGL_at_Haxe_US_2019 directory 16 | a HTML slide show 17 | 18 | again using Open Office 19 | 20 | -------------------------------------------------------------------------------- /Build/RunAll.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | 4 | rem Run C++ .Exe debug or not 5 | cd CPP_OUT 6 | if "%1"=="debug" ( 7 | :: run debug 8 | Main-Debug.exe 9 | ) else ( 10 | :: run release 11 | Main.exe 12 | ) 13 | 14 | pause 15 | cd .. 16 | 17 | 18 | 19 | rem Run C# .Exe 20 | 21 | cd CSharp_OUT/bin 22 | copy Main.exe .. 23 | cd .. 24 | 25 | cls 26 | 27 | Main.exe 28 | 29 | pause 30 | 31 | cd .. 32 | 33 | 34 | 35 | rem Run Python .py 36 | 37 | cd Python_OUT 38 | 39 | python main.py 40 | 41 | pause 42 | 43 | cd .. 44 | 45 | rem Run Java .jar 46 | 47 | cd Java_OUT 48 | 49 | java -jar Main.jar 50 | 51 | 52 | pause 53 | 54 | cd .. 55 | -------------------------------------------------------------------------------- /Docs/Maintainers/forGL_To_Do_2019_April.txt: -------------------------------------------------------------------------------- 1 | forGL To Do April 2019 2 | 3 | 4 | 5 | Prepare for GitHub publish April ? 6 | 7 | _forGL_Read_Me_First.txt 8 | 9 | 10 | Make progress on Export As feature 11 | 12 | 13 | Add typical CallThis( arg ) support At least for 0 or 1 arguments. 14 | 15 | Fix cursor positioning and text overwrite defects at least for C++ build. 16 | 17 | Support for Automated Testing 18 | Incoming values in .toml file 19 | Maybe as part of a Dictionary file ? 20 | 21 | Use of values to control forGL running 22 | Capture results of running to a forGL_Log_Verb_name.txt 23 | Dictionary name and Path will be first entry of the Log file 24 | 25 | 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[Feature_Request] forGL should " 5 | labels: '' 6 | assignees: RMax2015 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/forGL/FileTypes.hx: -------------------------------------------------------------------------------- 1 | /* FileTypes.hx Types of forGL files 2 | * 3 | * Prototype (VERY Experimental) of forGL application 4 | * 5 | * NOTES: 6 | * See block comment at end of this file for more information. 7 | * 8 | * ... 9 | * @author Randy Maxwell 10 | */ 11 | 12 | package forGL; 13 | 14 | 15 | // List of File types 16 | enum 17 | abstract FileTypes(Int) { 18 | 19 | var FILE_IS_UNKNOWN = 0; 20 | 21 | var FILE_IS_TEXT = 1; // .txt or log files like Export log 22 | 23 | var FILE_IS_DICTIONARY = 2; // .toml Dictionary 24 | 25 | // var FILE_IS_COMMANDS = 3; // possible list of commands to forGL app ? 26 | 27 | // var FILE_IS_DATA = 4; // possible data file to give to forGL app ? 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img0.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 1 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img19.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 20 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Build/Build.bat: -------------------------------------------------------------------------------- 1 | rem Build Haxe project to output various Programming Languages in different Directories 2 | 3 | rem C++ as Windows .Exe 32 bit 4 | rem 5 | rem haxe -debug --each -lib haxe-strings -cp src -cpp ./CppD_OUT -D debug -D annotate-source -main Main 6 | rem haxe -lib haxe-strings -cp src -cpp ./Cpp_OUT -main Main 7 | 8 | rem CppIA as .cppia file 9 | haxe -lib haxe-strings -cp src -cppia ./CppIA_OUT/main.cppia -main Main 10 | 11 | rem C# as Windows .Exe 12 | haxe -lib haxe-strings -cp src -cs ./CSharp_OUT -main Main 13 | 14 | rem Java as Main.jar 15 | haxe -lib haxe-strings -cp src -java ./Java_OUT -main Main 16 | 17 | rem JavaScript as forGL_WebWorker.js 18 | cd src 19 | copy /Y Main.hx WebWorker.hx 20 | cd.. 21 | haxe build_Worker.hxml 22 | 23 | rem Python as main.py 24 | haxe -lib haxe-strings -cp src -python ./Python_OUT/main.py -main Main -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img1.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 2 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 3 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img3.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 4 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img4.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 5 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img5.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 6 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img6.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 7 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img7.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 8 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img8.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 9 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img9.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 10 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img10.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 11 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img11.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 12 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img12.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 13 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img13.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 14 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img14.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 15 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img15.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 16 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img16.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 17 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img17.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 18 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/img18.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 19 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Text

11 |
12 | 13 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 3 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL Inputs

12 |

Natural Languages 13 |

Must be text based and simplified (European now) 14 |

15 |

Dictionary approach as common way 16 |

17 | 18 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text0.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 1 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL Information

12 |

GitHub has best information 13 |

https://github.com/RMax2015/forGL 14 |

Haxe Community Forum 15 |

search: 4GL or forGL 16 |

https://community.haxe.org 17 |

forGL is not a programming language but may act like one 18 | 19 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text7.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 8 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL NL Complexity

12 |

NL Punctuation : 13 |

I think some written languages do not 14 |

even use punctuation characters. 15 |

Instead I think just gaps represent punctuation. (Chinese? Others?) 16 |

Not sure. 17 |

I am no Linguist. 18 |

19 | 20 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text19.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 20 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

Forth Language

12 |

Charles H Moore created Forth 1970 13 |

Concatenative paradigm and others. 14 |

Dictionary of editable words to run. 15 |

Interpreter and Compiler. 16 |

Good fit for embedded or pre OS boot. 17 |

Https://en.wikipedia.org/wiki/Forth_(programming_language) 18 |

19 |

20 | 21 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2025 Randy Maxwell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text15.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 16 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL as an Application

12 |

Dictionary As Application (soon?) : 13 |

Key Ideas: Entire Dictionary and not just 1 Verb Exported As Code. CLI args and Menu added to support Automated running or Manual running. Args / Menu items refer to Verbs in Dictionary. 14 |

Using Göedel's Theorem & Thinking by Contract leads to ALSO extending Export As Code. 15 |

16 |

17 | 18 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text18.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 19 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

Amber Language (4GL)

12 |

Gerard W. Horgan, Willem van Rijk & others helped create/sell Amber with IDE. Proprietary ... 80's to early 2000's? 13 |

Amber did several European languages. Amber had Nouns, Verbs, Adjectives & Adverbs. Dictionaries had words in various languages and may switch as wanted. Had unlimited Math & newer Windows IDE. Apps in Amber could create GUI & buttons would run a Verb. 14 |

15 |

16 | 17 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text8.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 9 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL and Math

12 |

Math Notation : depends on context. 13 |

Different branches of Math use same notation to mean different things. Same notation may be used with different order of appearance. 14 |

Infix is typical & some prefix and postfix. 15 |

Math Concepts : 16 |

Absolute accuracy and exact precision may not fit well with computer Hardware or programming Software. 17 |

18 | 19 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text3.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 4 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL NL Simplification

12 |

Natural Languages (NL) simplified to: 13 |

Verbs, Nouns, Operators, Punctuation. 14 |

Key Idea ! 15 |

NL Dictionaries are widely known/used. 16 |

forGL Dictionary words <==> programs. 17 |

forGL Dictionary definitions : 18 |

easily read and changed by User 19 |

and run by forGL Interpreter. 20 | 21 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text9.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 10 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL and Math

12 |

Math Concepts : 13 |

Pure Math requires large effort to do correctly (consider Haskell). 14 |

forGL uses an Engineering approach. 15 |

Allows acceptable results for 16 |

(hopefully) a wide spectrum 17 |

of use cases. 18 |

1 to 1 mapping of forGL Math words 19 |

in Dictionary to Haxe Math support. 20 |

21 | 22 | -------------------------------------------------------------------------------- /Docs/Maintainers/References_Natural Languages.txt: -------------------------------------------------------------------------------- 1 | References_Natural Languages 2 | 3 | 4 | 5 | Natural Languages 6 | ============================================================================== 7 | 8 | Translation sites: 9 | 10 | English 11 | To / From with over a dozen other Languages 12 | https://www.collinsdictionary.com/translator 13 | 14 | 15 | German 16 | To / From with over a dozen other Languages 17 | https://en.langenscheidt.com/english-german/ 18 | 19 | 20 | 21 | Which languages are written right-to-left (RTL)? 22 | 23 | http://www.i18nguy.com/temp/rtl.html 24 | 25 | 26 | 27 | Fibonacci Example 28 | ============================================================================== 29 | 30 | A graphical introduction to dynamic programming 31 | 32 | Shows how to go from Recursive Fib to nice iterative Fib 33 | 34 | 35 | https://avikdas.com/2019/04/15/a-graphical-introduction-to-dynamic-programming.html?utm_medium=email&utm_source=topic+optin&utm_campaign=awareness&utm_content=20190420+prog+nl&mkt_tok=eyJpIjoiTUdRNFlqSm1aRFEzWTJJMyIsInQiOiJ1anlZT3hpTkVWMnA4XC9GMWg4MndURmQwUktKOEtaOFlvMk4zRjNmRXRSRHZMU3pJN1FYZjY3R1lpaWwwTUs0bTUzNWxzSXZxXC9yZ3RkUWRxVVROZzVJTHpET0JTK3hTT0RyN0N4NU9PYkprRXVCTnQwWGZuUnBYSXY1enZTMEFOIn0%3D 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text12.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 13 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL as an Application

12 |

Enable More Programmer Learning : 13 |

forGL Inference approach allows : 14 |

Use of text with various words not in Dictionary. Words not found are treated as simple passive Local Noun names and are ignored until used. 15 |

No Warnings or Errors for unknowns. 16 |

Dictionary approach allows use of a mix of real or fictional language words. 17 |

18 |

19 | 20 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text14.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 15 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL as an Application

12 |

Export As Code : 13 |

Key Ideas ! No other 4GL app allows 14 |

Export As Code. No other programming language environment Exports to Haxe. 15 |

A HA ! ! ! Moment : 16 |

Haxe chosen as easy way to be dangerous with JavaScript. Using Göedel's Theorem & Thinking by Contract leads to ALSO using Haxe as output of forGL. A HUGE WIN ... 17 |

18 |

19 | 20 | -------------------------------------------------------------------------------- /Applications/forGL_as_Application_READ_ME.txt: -------------------------------------------------------------------------------- 1 | forGL as an Application READ ME 2 | 3 | Here are different ways you can run forGL. 4 | 5 | These different ways are available so you do not need to install any extra software. 6 | 7 | Each of these ways use the same Dictionary file style as in the 8 | Dictionaries directory. 9 | 10 | You can choose any combination of files from these directories: 11 | 12 | Browser Not ready for ordinary use! NEEDS DEBUGGING ! ! ! 13 | 14 | Java at least Java 6 installed, Java 8 or later is recommended 15 | 16 | Python Python 3.6 or later installed 17 | 18 | 19 | If you are using Windows : 20 | ------------------------ 21 | 22 | If you want to use the Java or Python applications you also need to get 23 | ansicon.exe 24 | 25 | The version of ansicon.exe I use can be found at : 26 | http://adoxa.altervista.org/ansicon/ 27 | 28 | click on the link labeled : 29 | ANSICON v1.89 30 | 31 | Easier to download both DLL files and ansicon.exe and put them in same directory you created. 32 | 33 | and set the Windows text Code Page to UTF8 34 | chcp 65001 35 | 36 | NOTE : 37 | Testing was done on Windows 7 and 10. 38 | Not sure about how good is Windows support for UTF8 on older versions of Windows. 39 | 40 | 41 | Thanks for trying forGL ! 42 | Randy Maxwell -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text16.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 17 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL Testing Needed !

12 |

Test CLI on Windows, Linux and Mac 13 |

Test European languages 14 |

Test other Left to Right languages 15 |

(after i18n) Translation checking: 16 |

Test Messages, UI Labels... 17 |

(after JavaScript fix) Test in Browser 18 |

Test Languages with no Punctuation 19 |

(after GUI added) Test GUI features 20 |

(later) Test Right to Left languages 21 | 22 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text1.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 2 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL Goals

12 |

Anyone that can type on a computer* 13 |

can learn computer programming**. 14 |

Computer programming experience 15 |

or even English*** is not needed. 16 |

* Such as: Phones, Tablets, Laptops, Consoles, Desktops… 17 |

** Languages: Haxe, Haxe output languages, forGL itself... 18 |

*** Concept proved. More Internationalization work to do! 19 |

forGL is not a programming language but may act like one 20 | 21 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text4.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 5 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

ForGL NL Simplification

12 |

Not really Natural Language processing 13 |

Lexing: no recursion, 1 pass 14 |

Parsing: no recursion, 1 resolve* pass 15 |

Other passes reduce Interpreter work 16 |

or support features: Export As Code... 17 |

* Resolve pass: Infer obvious data. 18 |

Token search in Dictionary & any not 19 |

found set as Unknown and ignored. 20 |

Inferred as variables IF referenced. 21 | 22 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text13.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 14 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL as an Application

12 |

Enable Programmer Productivity : 13 |

Key Ideas: Export As Code, Comments, 14 |

Export As Application (soon?) 15 |

forGL Verb selected to Export As Code. 16 |

forGL syntax changed to Procedural. 17 |

Procedural syntax is run by Interpreter. 18 |

Avoids trying to Export some bugs. 19 |

Comments are Exported as well to allow Semantic Traceability. 20 |

21 |

22 | 23 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text6.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 7 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL NL Complexity

12 |

NL Parts of Speech : 13 |

English has between 10 to 20? parts of speech. 14 |

Greek has THOUSANDS. 15 |

forGL simplifies to: Verbs, Nouns, 16 |

Operators (from Math) and Punctuation. 17 |

NL Reading Order : 18 |

most Left to Right. 19 |

Hebrew & Arabic & others Right to Left. 20 |

Classical Chinese Top to Bottom 21 |

with Leftmost column first. 22 |

23 | 24 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text5.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 6 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL NL Complexity

12 |

NL word order is Complex : 13 |

English mostly uses Subject Verb Object. 14 |

I (s) like (v) Haxe (o). 15 |

https://en.wikipedia.org/wiki/Word_order 16 |

Gives other 5 word orders 17 |

and various exceptions 18 |

on a per Natural Language basis. 19 |

Key Idea ! forGL will not force word 20 |

order except as selected by User: 21 |

such as to support Export As Code. 22 |

23 | 24 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text11.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 12 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL as an Application

12 |

Enable Programmer Learning : 13 |

forGL allows Experimentation with : 14 |

Paradigms : 15 |

Imperative vs Declarative (Future goal) 16 |

Procedural vs Concatenative. 17 |

Concurrency & Objects added soon? 18 |

Notations : 19 |

Prefix, Infix, Postfix allowed. 20 |

Multiple ways to express Problems. 21 |

Use what seems best to you. 22 |

23 |

24 | 25 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text17.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 18 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL Changes Soon?

12 |

Add Automated Testing support (.toml) 13 |

Fix JavaScript to allow Testing & use 14 |

Fix Export As Code, Add Dict As App 15 |

Start Internationalization (i18n) 16 |

Start support for Right to Left languages 17 |

Add to API for other apps use, Games... 18 |

Refactor forGL without UI as a Haxe Lib 19 |

Add HaxeUI for Windows, Linux, Mac 20 |

CLI to use simplified Curses approach 21 |

Add native Mobile, Console, ... with GUI 22 | 23 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/text10.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 11 7 | 8 | 9 |
10 | First page Back Continue Last page Overview Graphics

11 |

forGL as an Application

12 |

Enable Beginning Programmers : 13 |

Simple things done in a simple way. 14 |

Full control of forGL options. 15 |

Options have usable defaults. 16 |

Display intermediate results as wanted. 17 |

Intermediate results help with 18 |

Understanding AND Debugging. 19 |

Informative Warnings and Errors. 20 |

Use Color to show: Nouns, Verbs, etc. 21 |

Overall ... use Best Known Practices. 22 |

23 |

24 | 25 | -------------------------------------------------------------------------------- /Docs/Maintainers/Dictionary As Application.txt: -------------------------------------------------------------------------------- 1 | Dictionary As Application 2 | 3 | 4 | This is an extension to the Verb Export As Code feature. 5 | 6 | Idea is to Export As Code the entire Dictionary. 7 | 8 | All Verbs become Procedures in the Simplified Programming Language 9 | and then whatever is correct in the final target language. 10 | 11 | All Nouns become Global Data items. 12 | 13 | All Local Nouns become local variables within the containing Procedure (original Verb). 14 | 15 | 16 | Also a really simple menu that just has 1 entry for each Verb Name (now Procedure Name). 17 | 18 | May also provide a CLI argument interface to allow Automated running. 19 | Cool idea: 20 | Menu is converted to something like COM IUnknown (JSON implementation perhaps) 21 | where individual interfaces can be discovered at runtime simply and by code. 22 | Interfaces would be really simple similar to IDL (or JSON or GRPC or ?) without extra stuff. 23 | 24 | Later this Cool idea could be expanded to like a file based DLL approach that is OS neutral. 25 | 26 | AND / OR 27 | 28 | User could select the Procedure to run. 29 | If Procedure needs some input data then User provides that as well. 30 | 31 | Simple yet could be quite useful because: 32 | 33 | Code runs at Compiled or JIT Compiled or Efficient Interpreter speed 34 | instead of forGL Interpreter speed. 35 | 36 | Sometimes you have already defined the Solution 37 | and you do NOT want extra flexability and complexity of the forGL Interpreter. 38 | 39 | Sometimes you want to do A / B testing and this way it is easy to select either. 40 | 41 | Sometime you want to run just a part of the Solution. Testing use or ??? 42 | 43 | -------------------------------------------------------------------------------- /Docs/Presentations/HTML/forGL_at_Haxe_US_2019/forGL_at_Haxe_US_2019.htm: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Slide 1 7 | 8 | 9 |
10 |

Click here to start

11 |
12 |
13 | 35 |
14 |

Table of contents

15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
36 |

Author: Randy Maxwell

37 |
38 | 39 | -------------------------------------------------------------------------------- /Applications/Browser/index_forGL.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | . forGL ... Interpreter . 7 | 8 | 9 | 10 | 13 | 14 |

15 | 16 |

forGL welcomes You!

17 | 18 |
19 | Please type your Verb and RUN when ready. 20 | 21 | 22 | 23 |
24 | 25 |
26 | Verb (as Run by forGL) 27 | 31 | 32 |

Data

33 |

Operators

34 |

Nouns

35 |
36 | 37 |
38 | Results of Show from your Verb 39 | 40 |
41 | 42 |
43 | Messages 44 | 45 |
46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve forGL 4 | title: "[Defect] Problem with " 5 | labels: '' 6 | assignees: RMax2015 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Did you try to find more information in the Docs directory or elsewhere ?** 14 | If not, then please help the forGL Team to help you! 15 | 16 | Part of **learning how to do computer programming is:** 17 | **looking through information already provided to save you some time and effort.** 18 | 19 | forGL project tries to make learning computer programming as rewarding as possible for you. 20 | 21 | You also should try to learn good habits when programming. 22 | **Strong Suggestion: Please read from the Docs directory and other places.** 23 | This will help you going forward. 24 | 25 | **Did you find any information you thought was related to the bug ?** 26 | If so, please suggest how the information may be improved. 27 | 28 | **Did you try to do other steps to work around the bug ?** 29 | Please describe what other steps you tried. 30 | 31 | If you did not try other steps: 32 | forGL Team is always looking for ways to improve forGL and your help is needed. 33 | Please let us know a little about why you did not try other ways. 34 | 35 | **To Reproduce** 36 | Steps to reproduce the behavior: 37 | 1. Go to '...' 38 | 2. Click on '....' 39 | 3. Scroll down to '....' 40 | 4. See error 41 | 42 | **Expected behavior** 43 | A clear and concise description of what you expected to happen. 44 | 45 | **Screenshots** 46 | If applicable, add screenshots to help explain your problem. 47 | You do not need to do a screenshot if the forGL text describes the problem, so you should have included the forGL text above when you described the problem (bug). 48 | 49 | **Desktop (please complete the following information):** 50 | - OS: [e.g. iOS] 51 | - Browser [e.g. chrome, safari] 52 | - Version [e.g. 22] 53 | 54 | **Smartphone (please complete the following information):** 55 | - Device: [e.g. iPhone6] 56 | - OS: [e.g. iOS8.1] 57 | - Browser [e.g. stock browser, safari] 58 | - Version [e.g. 22] 59 | 60 | **Additional context** 61 | Add any other context about the problem here. 62 | -------------------------------------------------------------------------------- /Docs/Maintainers/Software_Karaoke__forGL__Question.txt: -------------------------------------------------------------------------------- 1 | forGL ... Software Karaoke ? ! . 2 | 3 | A forGL musical answer to the question: Why even use forGL? 4 | 5 | This is a light hearted attempt at some humor using Karaoke, 6 | with some changes to help give insights about 4GL and computer programming. 7 | 8 | 9 | Why Can't This Be Code ? 10 | 11 | Music and (mostly) Original Lyrics (as scrolling text) 12 | https://www.youtube.com/watch?v=YH1ilVfhjbU 13 | 14 | Below is suggested lyrics to sing when viewing above video. 15 | Have Fun ! 16 | 17 | All the underlined text below was a substitute for original song lyrics. 18 | 19 | 20 | Oh here it comes 21 | That funny feeling again winding me up inside 22 | Every time we touch 23 | Hey I don't know 24 | Oh, tell me where to begin cause I never ever 25 | Saw so much 26 | --- 27 | And I can't recall any code at all 28 | ---- 29 | 30 | Baby this shows another way. 31 | ----------------- 32 | 33 | It's got what it takes 34 | So tell me why can't this be code? 35 | ---- 36 | Straight from my mind 37 | ---- 38 | 39 | Oh, tell me why can't this be code? 40 | ---- 41 | I tell myself 42 | Hey not just fools rush in and only time will tell 43 | -------- 44 | If we stand the test of time 45 | All I know 46 | You've got to run code to win and so this can 47 | ---- ----------- 48 | be much more than just fine. 49 | --------------------------- 50 | 51 | Hey 52 | No I can't recall any code at all 53 | ---- 54 | Oh baby this shows another way. 55 | ----------------- 56 | Woo 57 | It's got what it takes 58 | So tell me why can't this be code? 59 | ---- 60 | You want it straight from my mind 61 | ------- 62 | 63 | Oh tell me why can't this be code? 64 | ---- 65 | It's got what it takes 66 | So tell me why can't this be code? 67 | ---- 68 | Straight from my mind 69 | ---- 70 | 71 | Oh, tell me why can't this be code? 72 | ---- 73 | Baby why can't this be code? 74 | ---- 75 | Got to know why can't this be code? 76 | ---- 77 | I wanna know why can't this be code? 78 | ---- 79 | 80 | Original Song ... Why Can't This Be Love by Van Halen 81 | Songwriters: Alex Van Halen / Edward Van Halen / Sammy Hagar / Michael Anthony 82 | Why Can't This Be Love lyrics © Warner/Chappell Music, Inc -------------------------------------------------------------------------------- /Docs/Maintainers/References_Programming Languages & Browsers.txt: -------------------------------------------------------------------------------- 1 | References_Programming Languages & Browsers 2 | 3 | 4 | Data & Design 5 | Fusing data and design to supercharge innovation—in products and processes 6 | 7 | architect Eliel Saarinen’s advice to 8 | “always design a thing by considering it in its next larger context— 9 | a chair in a room, a room in a house, a house in an environment, an environment in a city plan” 10 | 11 | https://www.mckinsey.com/business-functions/mckinsey-analytics/our-insights/fusing-data-and-design-to-supercharge-innovation-in-products-and-processes?utm_medium=email&utm_source=topic+optin&utm_campaign=awareness&utm_content=20190424+data+nl&mkt_tok=eyJpIjoiWVRKbFlqaGhOV0l3WXpGaCIsInQiOiJVUU1ROVwvTld2RHU0Y3I1K2VxbDZhOWxobWx2QktMVWpsYU41ajBrc0xvakhNa2Vnc2JqZ2g5dXU5TjJIdllHR1ZPM2UxOWtNYitTZ2F3QUVXbXJvOXRsOFNhQndrdklhN1pZdWx4NEFxcE1pM3lcL1c3c0NBQ3Jydzh5c0lnMEsrIn0%3D 12 | 13 | 14 | Programming Languages & Browsers 15 | ============================================================================== 16 | 17 | Browsers: Lin Clark (Code Cartoonist and Mozilla developer) 18 | The future of Web Browsers is Parallel. 19 | Coarse Grained Parallelism, Fine Grained Parallelism, 20 | Faster App code using: Web Workers, Better JavaScript engines, WebAssembly 21 | Rust as implementation language merged into newer FireFox browsers. 22 | https://www.youtube.com/watch?v=xCBWS8G5Cm0&ab_channel=JSKongress 23 | 24 | 25 | Anders Hejlsberg 26 | talks about programming and compilers ... 27 | Algol -> Pascal subset -> Pascal -> Marketed as Turbo Pascal -> Visual J++ 6.0 -> .Net and C# -> TypeScript 28 | "... don't accept the dogma." 29 | Keep an open mind. 30 | ~13 minutes 31 | https://www.youtube.com/watch?v=tmOmFfcA9us 32 | 33 | 34 | Anders Hejlsberg 35 | on Modern Compiler Construction 36 | 37 | "...using Functional programming ideas within modern compilers..." 38 | 39 | https://www.youtube.com/watch?v=wSdV1M7n4gQ 40 | 41 | 42 | Guido van Rossum: BDFL Python 3 retrospective 43 | 44 | 45 | 46 | https://www.youtube.com/watch?v=Oiw23yfqQy8 47 | 48 | 49 | Go language Authors Panel 50 | 51 | Go can compile to WebAssembly 52 | 53 | Goals: 54 | Concurrency easy to do 55 | Compactness 56 | Readability and Ease of Understanding 57 | Designed for Programming in the Large 58 | 59 | Problems: 60 | Int is 32 or 64 bits. 61 | Should have had explicit Int32 and Int64 62 | 63 | Context feature 64 | 65 | https://www.youtube.com/watch?v=3yghHvvZQmA&feature=youtu.be&utm_medium=email&utm_source=topic+optin&utm_campaign=awareness&utm_content=20190420+prog+nl&mkt_tok=eyJpIjoiTUdRNFlqSm1aRFEzWTJJMyIsInQiOiJ1anlZT3hpTkVWMnA4XC9GMWg4MndURmQwUktKOEtaOFlvMk4zRjNmRXRSRHZMU3pJN1FYZjY3R1lpaWwwTUs0bTUzNWxzSXZxXC9yZ3RkUWRxVVROZzVJTHpET0JTK3hTT0RyN0N4NU9PYkprRXVCTnQwWGZuUnBYSXY1enZTMEFOIn0%3D 66 | 67 | 68 | 69 | Anders Hejlsberg 70 | 71 | FiveThings Why TypeScript is for You 72 | 73 | Useful if you are now doing JavaScript or want to do JavaScript 74 | 75 | 1) Static Types 76 | Types are good to find Errors Statically instead of at Run time. 77 | Refactoring 78 | 79 | 2) 80 | can down level back to older versions of JavaScript 81 | 82 | TypeScript written in JavaScript ! ! ! 83 | (Huge advantage over Haxe) 84 | 85 | 86 | 4) What about if you want to stop using TypeScript ? 87 | 88 | Comments in TypeScript compiled to JavaScript (and style is preserved) 89 | 90 | 5) 91 | 92 | https://www.youtube.com/watch?v=wYgSiFaYSSo 93 | 94 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at RMax2015@github.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /Docs/Maintainers/Haxe Multi Target Language Page.txt: -------------------------------------------------------------------------------- 1 | Email Suggest Haxe Multi Target Language Page Be Created 2 | 3 | I have a Use Case in mind: 4 | 5 | forGL is going to introduce A LOT of new programmers (perhaps with little 6 | prior experience) to Haxe. 7 | Also I expect that a significant fraction (over 50%) may have little or no 8 | command of English. 9 | 10 | For my part, I will put in place documents, tips, FAQs, translated messages 11 | in the code, and so on to help support those new programmers. I will be 12 | relying on the Open Source community spirit of sharing that will prompt 13 | others with skills about various languages to help with translations. 14 | 15 | I will also in the forGL side of docs do my best to help programmers with a 16 | fairly wide range of experience to use the somewhat unique capabilities of 17 | forGL as best as they may. 18 | 19 | I do not automatically favor choosing simplicity over a better description 20 | that includes high level ideas as well as low level details. And the forGL 21 | doc set will apply this use of multiple view points as well. 22 | 23 | *But here we are trying to improve the experience of programmers using Haxe 24 | from a wide variety of levels of backgrounds. They may be very experienced 25 | in a few of the target languages but have little experience with working 26 | with multiple languages at once. From a past interview with Amazon I know 27 | that they are very heavily (almost exclusively) into Java for example 28 | (around 2011).* 29 | 30 | In the past the most useful programs that I have found were those that gave 31 | the User a choice about what level of detail to work with. Ex: there would 32 | be a menu item that would show all menu items to approach all details or 33 | just the most commonly used menu items. Now it seems for quite a few 34 | programmings IDEs to allow the User/Programmer to customize what even gets 35 | shown (which I and many others appreciate). 36 | 37 | So the principle is: 38 | Having intelligent *Choices *is a GOOD THING. 39 | 40 | *A simple example is good.* 41 | 42 | *Also a somewhat realistic example of medium to complicated where 43 | intelligent choices were made to handle the extra complexity I believe even 44 | better.* 45 | 46 | So my strong suggestion is to have a short explanation about both the 47 | simple and the more involved examples. 48 | 49 | *Another factor to keep in mind is that these language setup pages need to 50 | treat unique aspects of Haxe programming well.* So either having both 51 | simple examples *and *more involved 52 | OR 53 | *Creating another page specifically to address tips about managing a Haxe 54 | project that uses multiple target languages would be the right thing for 55 | even very experienced programmers as well as those just learning.* 56 | 57 | 58 | If you decide to create a page about considerations of Haxe projects with 59 | multiple target languages, I would strongly suggest to not just limit to 60 | talking about examples of more complicated directories but rather talk 61 | about trade offs like: 62 | Which IDEs Editors support both editing Haxe AND the target language(s) 63 | Which IDEs Debuggers support Debugging in a target language that also has a 64 | source view of original Haxe while Debugging 65 | 66 | and so on. I am sure you can add a lot more to this list. 67 | 68 | I think if there is a new page created to help guide choices of Haxe and 69 | multiple target languages, going through (at least with links or SOME 70 | bullet points) of the various activities of a full SDLC would also help to 71 | bring important high level ideas that Haxe uniquely provides as a 72 | constructive background. 73 | 74 | Sorry I can't provide more help now but my "Hobby" is beginning to take up 75 | more of my time. 76 | Hope this helps! 77 | Randy Maxwell -------------------------------------------------------------------------------- /_forGL_Getting_Started_READ_ME_NOW.txt: -------------------------------------------------------------------------------- 1 | forGL Getting Started 2 | 3 | April 2020 4 | 5 | Please consider these directories 6 | Applications 7 | Dictionaries 8 | Docs 9 | 10 | If you want to USE forGL: 11 | ======================== 12 | 13 | Please: 14 | Create a new directory (folder). 15 | 16 | Copy at least 1 file from the Dictionaries directory (folder). 17 | 18 | Go to the Applications directory and READ the READ_ME.txt file. 19 | 20 | Copy the forGL application you selected to the new directory. 21 | 22 | Copy from the Dictionaries directory. 23 | 24 | Create a simple Windows .bat file or a shell script file. 25 | 26 | You can also run forGL from the command line without a .bat or script. 27 | 28 | 29 | 30 | If you want to BUILD and run forGL: 31 | ================================== 32 | 33 | Please consider trying out the USE section above first. 34 | 35 | forGL is mostly Haxe sources. 36 | Now building as a Command Line Interface text style application. 37 | Later this year as native GUI apps. 38 | Hopefully soon as mostly working Browser app (instead of poorly working now). 39 | 40 | Build 41 | ----- 42 | directory has sample Windows .bat files I use to: 43 | Run Haxe transpiler to build all or 1 at a time. 44 | Run 5 different generated programming languages, all or 1 at a time. 45 | 46 | forGL Builds with Haxe 4.0 and up Releases 47 | forGL was built with Haxe 3.4.x and 4.0 up to 4.0 rc2 48 | 49 | forGL currently uses Haxe to generate: 50 | C++, C#, Java, Python and JavaScript (a Browser Web Worker) 51 | 52 | I also generate CppIA but am not testing with it yet. 53 | 54 | 1) Choose a Haxe Toolkit version and Install Haxe compiler + tools 55 | or you can choose a nightly 4.0 build from Haxe github site. 56 | 57 | See: 58 | https://haxe.org 59 | and 60 | https://community.haxe.org 61 | 62 | 2) Choose and Install language support: 63 | You do NOT have to install all of these. 64 | You can choose practically any 1 of these 65 | for Haxe to generate and then you can run. 66 | 67 | C++, hxcpp (includes CppIA) 68 | C#, hxcs 69 | Java hxjava 70 | 71 | There are pages on the Haxe site to help you start with the above languages. 72 | 73 | Python and JavaScript support are included as part of Haxe Toolkit. 74 | 75 | I installed all of the above on my Windows laptops. 76 | The reasons are: 77 | C++ for performance and cross platform 78 | C# for Windows centric (also easy to Debug on my old laptop) 79 | Java for cross platform OK performance 80 | Python for cross platform 81 | JavaScript for Browser app 82 | 83 | 3) Install haxe-strings library 84 | This provides better UTF8 support (especially if building with Haxe 3.4) 85 | and ANSI Escape sequences to do text Colors and Cursor moves. 86 | 87 | Python 88 | ------ 89 | After Python is built open in an editor of your choice. 90 | I use Notepad++ on Windows. 91 | 92 | Searh & Replace 93 | __python__(" 94 | 95 | with nothing. 96 | 97 | The the Python code can be run. 98 | This fixes a minor defect in how Haxe generates Python comments 99 | in a macro from the Comments.hx file. 100 | 101 | 102 | Comments ! ! ! 103 | forGL uses a Comments.hx source file that embeds Comments in Haxe generated sources. 104 | Having Comments has helped me a lot finding my way around when Debugging forGL. 105 | 106 | Comments ALSO are KEY to enabling anyone using forGL to better understand 107 | their own code (Verbs) when Exported to Haxe and then transpiled to whatever. 108 | 109 | If you are running on Windows (like I do) 110 | please see the Read ME files in the Applications directory (ansicon.exe and chcp 65001). 111 | 112 | Thanks to Haxe Community Forum members and Haxe Team ! 113 | 114 | Hope this helps. 115 | Thanks for your support! 116 | Randy Maxwell 117 | -------------------------------------------------------------------------------- /Docs/Maintainers/Syntax Ideas and Programming Paradigms.txt: -------------------------------------------------------------------------------- 1 | Syntax Ideas and Programming Paradigms 2 | 3 | NOW April 2019 4 | 5 | forGL NOW (April 2019) has 6 | fairly good working Concatenative 7 | & very limited Imperative choice & Declarative syntax / notation. 8 | 9 | Concatenative 10 | ============= 11 | forGL allows a wide variety of combinations of the parts of a statement: 12 | Nouns Name of and Value given to: a person, place or thing 13 | Verbs Choose the terms you want to describe either the Problem or Solution or both 14 | Operators Imperative in effect, some help with not being too close to HW 15 | Verbs that are Built In Declarative ... sat WHAT you want and it will be done 16 | Punctuation some way to see that there is an end of a statement 17 | 18 | Imperative Notation 19 | =================== 20 | These are ideas that express HOW to do something. 21 | Math operators 22 | 23 | Math functions 24 | You can point out that Math functions are Declarative typically. 25 | 26 | Choice based on a Bool comparison. true or false 27 | If true a reading (and execution) path through the Verb is chosen. 28 | If false the reading path for the true comparison is skipped over. 29 | 30 | 31 | Examples: 32 | 33 | 34 | 35 | 36 | 37 | 38 | Declarative Notation NOW April 2019 39 | ==================== 40 | 41 | WHAT you want and it will be done 42 | 43 | Show a Value from the Data stack is displayed in the User Interface 44 | 45 | Repeat will use a Data stack value as a beginning Repeat Count to do. 46 | Repeat Count value should be a positive Integer (1 or more). 47 | 48 | 49 | Error Handling 50 | ============== 51 | 52 | If show has no value then this is a Problem: 53 | 1) This is a logical error in the Verb OR a Verb that ran before this Verb. 54 | Display the fact that no Data value is available and stop. 55 | 56 | OR 57 | 2) This is a logical error in the Verb OR a Verb that ran before this Verb. 58 | Instead add an entry to the Run log and run the next word. 59 | 60 | OR 61 | 3) This is a logical error in the Verb OR a Verb that ran before this Verb. 62 | Do nothing about Problem that show has and run the next word. 63 | 64 | 1) is done now 65 | 2) needs Logging to be implemented and then you allow Logging 66 | 3) is the most dangerous because the Problem is ignored (see Defects NOTE) 67 | 68 | Reapeat has similar Error Handling needs 69 | 70 | 71 | 72 | forGL Defects NOTE 73 | ================== 74 | Because forGL is a prototype with various Defects that are Known 75 | and other Defects not found yet: 76 | The forGL application will make statements 77 | about what seems to be likely reasons for a Problem. 78 | 79 | forGL may actually have an Internal Defect that caused the Problem such as: 80 | Not doing an Assignment to the correct Noun. 81 | Not creating a Data value correctly. 82 | Not putting a Data value on the Data stack correctly. 83 | 84 | The above Defects have been fixed in some combinations that were tested but: 85 | MUCH more testing is needed. 86 | Need Automated tests to detect old fixed Defects that happen again. 87 | 88 | 89 | 90 | Procedure Call Notation SOON April to May 2019 91 | ======================= 92 | 93 | It is important you understand Procedure calls and their very wide use in programming languages. 94 | Working examples of Procedure calls from your selected forGL Verb(s) are part of Export As Code. 95 | 96 | Instead of the Concatenative notation that forGL supports 97 | you may use a style that MANY programming languages use. 98 | 99 | concatenative: 100 | "Hello there!" show. 101 | 102 | procedure call: 103 | show( "Hello there!" ). 104 | 105 | concatenative: 106 | 45 radians sin into x. x show. 107 | or even 108 | 45 radians sin show. 109 | 110 | sin called like a procedure but the argument within ( ) is concatenative: 111 | sin(45 radians) into x. x show. 112 | 113 | all procedural and have Assignment in Math style that most programming languages use. 114 | x = sin(radians(45)). show(x). 115 | or even 116 | show(sin(radians(45))). 117 | 118 | 119 | 120 | SOON April to May 2019 121 | forGL will support 0 or 1 Procedure arguments. 122 | 123 | examples: 124 | show( 7 ). 125 | 126 | show(). The Data value that show( ) needs is not given as an argument. 127 | This is likely an error when typing this statement. 128 | Error Handling as given above for show. 129 | Also 130 | Because the Procedural is in addition to the Concatenative style: 131 | If statement was like: 132 | 7 show(). 133 | It could be changed to: 134 | show(7). That is correct and as intended by the Verb definition. 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | Declarative Notation SOON April to May 2019 145 | ==================== 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /Docs/Maintainers/forGL_References.txt: -------------------------------------------------------------------------------- 1 | forGL_References 2 | 3 | April 2019 4 | 5 | REALLY IMPORTANT forGL IDEAS 6 | ============================ 7 | forGL is an application and not a programming language. 8 | 9 | forGL does: 10 | allow you to try out a simplified Natural Language of your choice to program a computer ... 11 | allow you to learn a few ideas about computer programming ... 12 | allow you to Export As Code the simplified Natural Language Verbs and Nouns 13 | to various computer programming languages to enable more learning... 14 | 15 | forGL does not: 16 | try to get you to adopt a "purest" viewpoint about programming language theory ... 17 | try to encourage or even force you to do something the "forGL way". There is no "forGL way" ... 18 | 19 | forGL uses ideas from Natural Language and various programming languages 20 | and a few small contributions of my own. 21 | 22 | If you are worried about Slow forGL Performance: 23 | forGL application provides an Interpreter, a User Interface, and (on some platforms) file input / output. 24 | forGL Interpreter is designed to support very flexible combinations of Verbs, Operators, Nouns. 25 | The flexible combinations (syntax) are to support the simplified Natural Languages of the world. 26 | forGL Interpreter uses Data, Operator and Noun stacks (and some others). 27 | Because of the stack based Interpreter, forGL is not as fast as other approaches. 28 | Because of the ability for you to Export As Code your forGL Verbs: 29 | other programming languages may be used to run the same logic you defined. 30 | These other programming languages have many years of effort to not give up performance. 31 | 32 | 33 | Limitation: No Network programming. 34 | If you want to do programming using Networks: 35 | forGL does not directly support you programming using various Networking APIs. 36 | This is a forGL Design Choice. 37 | The reason is that using Networking APIs can lead to subjects and problems 38 | that are much more advanced than working with programming a single computer platform. 39 | 40 | Limitation: No File system programming. 41 | If you want to do programming using the File system of a platform: 42 | forGL does not directly support you programming using various File system APIs. 43 | This is a forGL Design Choice. 44 | The reason is that using File system APIs can be used to do destructive actions on the platform 45 | even when the intention of the code is not to be destructive. 46 | 47 | THE ABOVE LIMITATIONS are chosen to help avoid several problems in the areas of forGL Security and Safety. 48 | 49 | 50 | 51 | Here is a list of some References that guided my thinking. 52 | 53 | Really Important Ideas 54 | ====================== 55 | 56 | If you don't read anything else please consider these: 57 | 58 | Gödel's Theorem (Kurt Gödel) 59 | ----------------------------- 60 | Proved for Mathematics systems using Symbolic Logic. 61 | 62 | My paraphrase: 63 | You can't learn everything about a system from within that system. 64 | You need to go outside the system to learn more. 65 | 66 | My Assertion: 67 | Gödel's Theorem applies to much more than just Mathematics. 68 | 69 | 70 | Thinking by Contract 71 | -------------------- 72 | Extending Design by Contract idea to other activities. 73 | 74 | also see 75 | Thinking_by_Contract.doc 76 | 77 | So I applied Thinking by Contract and Gödel's Theorem ideas together on forGL. 78 | 79 | I had some previous experience with about a dozen programming languages. 80 | I wanted to enable people to do computer programming like my experience at 81 | Amber Software / Cyware. 82 | 83 | Practically all of the most used programming languages 84 | require (as a Pre Condition) some knowledge of English. 85 | 86 | I wanted to remove English as a requirement (Pre Condition) 87 | for learning computer programming, 88 | as Amber allowed European languages to be used. 89 | 90 | 91 | 92 | 93 | Programming Languages 94 | ===================== 95 | 96 | Programming language creators talk: 97 | Guido van Rossum (Python) 98 | James Gosling (Java) 99 | Anders Hejlsberg (TurboPascal, Delphi, C#, TypeScript) 100 | Larry Wall (a Linguist. Perl, Perl6) 101 | Carol Willy (Moderator, Jupyter, Jupyter notebooks) 102 | https://www.youtube.com/watch?v=csL8DLXGNlU&t=48m30s&utm_medium=email&utm_source=topic+optin&utm_campaign=awareness&utm_content=20190406+prog+nl&mkt_tok=eyJpIjoiTVRJMVpUWXdNbUUxT1dRMSIsInQiOiJWUmJqNVoyNzhmUWNNMlVHb1FSNHdYejJKUFU0MytrTVwvN3B1YUtXU0MwUXBUdExoeUtBUElVb2pUZGFoaHg1Ym1cL1VOV0ZHTjRWREZoYmZGTmhDcWk2cUZnelcyTEFvUUFiOE5lVVMwT3pSV0hORHhGd21NbVRubFNydE5IdWxLIn0%3D 103 | 104 | 105 | 106 | 107 | Repository Related 108 | ================== 109 | 110 | Guidelines to providers and users of public Software Repositories 111 | https://softwareengineeringdaily.com/2019/04/04/project-health-assessing-open-source-projects-with-more-context/ 112 | 113 | 114 | 115 | 116 | Hope this helps! 117 | Randy Maxwell -------------------------------------------------------------------------------- /src/forGL/js/forGL_Load_Run.js: -------------------------------------------------------------------------------- 1 | /** forGL_Load_Run.js This runs in Browser to support forGL with a HTML GUI 2 | * 3 | * @author Randy Maxwell 4 | */ 5 | 6 | (function() { 7 | 8 | var is_running = false; 9 | 10 | var oscpu = window.navigator.oscpu; 11 | // console.log( "oscpu :" + oscpu ); 12 | 13 | var verbose_console_log = true; 14 | 15 | // Set up to use various UI pieces 16 | var dict_name_element = document.getElementById( "dictionaryNameId" ); 17 | var dict_text_element = document.getElementById( "dictionaryTextId" ); 18 | 19 | var status_text_element = document.getElementById( "statusId" ); 20 | 21 | var run_stop_button = document.getElementById( "runButtonId" ); 22 | var user_verb_element = document.getElementById( "userVerbId" ); 23 | 24 | var verb_colored_element = document.getElementById( "verbColoredTokensId" ); 25 | 26 | var data_stack_element = document.getElementById( "dataStackId" ); 27 | var op_stack_element = document.getElementById( "opStackId" ); 28 | var noun_stack_element = document.getElementById( "nounStackId" ); 29 | 30 | var verb_output_element = document.getElementById( "verbOutputId" ); 31 | 32 | var messages_element = document.getElementById( "messagesId" ); 33 | 34 | var forGL_Worker = document.HTMLElement; 35 | 36 | // Create a Web Worker (separate thread from Browser) 37 | var using_web_worker = false; 38 | if ( window.Worker ) 39 | { 40 | forGL_Worker = new Worker( 'forGL_WebWorker.js' ); 41 | using_web_worker = true; 42 | alert( "using_web_worker !" ); 43 | } 44 | else 45 | { 46 | // Change this to load forGL as JavaScript (but not a Web Worker) 47 | // 48 | 49 | var msg = 'INTERNAL ERROR: No Web Worker from Browser available. Need to refactor forGL. Stopping.'; 50 | status_text_element.textContent = msg; 51 | console.log( msg ); 52 | alert( msg ); 53 | document.close(); 54 | return; 55 | } 56 | 57 | if ( verbose_console_log ) 58 | { 59 | // Set the Check Box 60 | 61 | 62 | } 63 | 64 | var sendRequest = function( request_str, data_str ) 65 | { 66 | if ( using_web_worker ) 67 | { 68 | // Send Request and other Data as Array of 2 Strings 69 | forGL_Worker.postMessage( [ request_str, data_str ] ); 70 | } 71 | else 72 | { 73 | // Put the Request into the queue 74 | 75 | } 76 | 77 | if ( verbose_console_log ) 78 | { 79 | var log_msg = 'Message to forGL: '+ request_str + ' data: ' + data_str; 80 | console.log( log_msg ); 81 | } 82 | }; 83 | 84 | 85 | var msg_result = ''; 86 | var msg_data = ''; 87 | 88 | forGL_Worker.onmessage = function( msg_back ) 89 | { 90 | msg_result = msg_back.data[ 0 ]; 91 | msg_data = msg_back.data[ 1 ]; 92 | /* 93 | if ( verbose_console_log ) 94 | { 95 | var log_msg = 'forGL Result: '+ msg_result + ' Data: ' + msg_data; 96 | console.log( log_msg ); 97 | } 98 | */ 99 | 100 | // Save message details as needed into appropriate variables 101 | switch ( msg_result ) 102 | { 103 | case "data_stack": 104 | data_stack_element.textContent = msg_data; 105 | break; 106 | 107 | case "error": 108 | messages_element.textContent += msg_data; 109 | status_text_element.textContent = msg_data; 110 | alert( msg_data ); 111 | break; 112 | 113 | case "information": 114 | messages_element.textContent += msg_data; 115 | break; 116 | 117 | case "message": 118 | messages_element.textContent += msg_data; 119 | break; 120 | 121 | case "noun_stack": 122 | noun_stack_element.textContent = msg_data; 123 | break; 124 | 125 | case "op_stack": 126 | op_stack_element.textContent = msg_data; 127 | break; 128 | 129 | case "status": 130 | status_text_element.textContent = msg_data; 131 | break; 132 | 133 | case "verb_output": 134 | verb_output_element.value += msg_data; 135 | break; 136 | 137 | case "verb_tokens": 138 | verb_colored_element.value = msg_data; 139 | break; 140 | 141 | case "warning": 142 | messages_element.textContent += msg_data; 143 | break; 144 | 145 | default: 146 | //if ( ! verbose_console_log ) 147 | //{ 148 | var log_msg = 'forGL Result: ' + msg_result + 'NOT handled. Data: ' + msg_data; 149 | console.log( log_msg ); 150 | //} 151 | 152 | break; 153 | } 154 | return; 155 | }; 156 | 157 | 158 | 159 | 160 | 161 | var sendDictionary = function( ) 162 | { 163 | var dict_text = dict_text_element.srcdoc; 164 | console.log( dict_text ); 165 | sendRequest( "dictionary", dict_text ); 166 | return; 167 | }; 168 | 169 | 170 | 171 | run_stop_button.onclick = function( e ) 172 | { 173 | if ( is_running ) 174 | { 175 | var log_msg = 'STOP Running !'; 176 | console.log( log_msg ); 177 | isRunning = false; 178 | run_stop_button.textContent = "RUN"; 179 | sendRequest( 'stop', '' ); 180 | } 181 | else 182 | { 183 | var user_verb = user_verb_element.value; 184 | var log_msg = 'Run User Verb: ' + user_verb; 185 | console.log( log_msg ); 186 | isRunning = true; 187 | run_stop_button.textContent = "STOP"; 188 | sendRequest( 'run', user_verb ); 189 | } 190 | return; 191 | }; 192 | 193 | verbose_console_log = false; 194 | sendRequest( "using_web_worker", using_web_worker ); // Help initialize forGL as Web Worker or not 195 | sendRequest( "oscpu", oscpu ); 196 | 197 | 198 | sendDictionary(); 199 | 200 | verbose_console_log = true; 201 | 202 | 203 | 204 | })(); -------------------------------------------------------------------------------- /Docs/_forGL_Docs_Read_Me_First.txt: -------------------------------------------------------------------------------- 1 | forGL R E A D M E F I R S T 2 | 3 | revised: July, 2025 4 | by: Randy Maxwell 5 | 6 | Summary 7 | =============== 8 | forGL enables you to begin learning about computer programming. 9 | forGL allows you to run your programs in several different ways. 10 | 11 | forGL is an application that sometimes acts like a programming language. 12 | When using forGL you may use your own language and not just English. 13 | 14 | forGL allows your programs to be saved to various programming languages, 15 | when the Export feature is implemented and tested. 16 | 17 | Key Ideas 18 | ----------------- 19 | No prior experience with programming is needed. 20 | Thinking about Problems/Solutions logically helps. 21 | Some experience with a calculator or calculator program helps. 22 | User/Programmer edits definitions of Words in a Dictionary. 23 | Words may be in any language and not limited to English. 24 | 25 | Word types are: 26 | Nouns (data) integers, floats, bools, strings 27 | Local Nouns Nouns that get added and removed while running and not saved in the Dictionary. 28 | Verbs (code) any combination of word types you may edit 29 | Verbs Built In (code) utility Verbs to do a specific task Show is an example. 30 | Operators (ex: Math or Logic, Punctuation) + - / * exp, log, trig, etc. 31 | 32 | The order of Nouns, Verbs and so on is not fixed. Nearly any order will work. 33 | Punctuation is the characters ; , . : Punctuation is used naturally to show the end of a phrase or sentence. 34 | European style simplified Natural Languages of course have a period . at the end of each sentence. 35 | 36 | A Verb may have any mix of Languages within; Ex: English, German, Spanish, Math, Logic, Vulcan, whatever. 37 | Different colors are used to show different Word types. 38 | 39 | 40 | Setup (there is no install program) 41 | ==================================== 42 | 43 | Create a directory and copy some files. 44 | 45 | Windows OS users need to do a few more steps as below. 46 | 47 | Please see the Operations section below after you finish setup. 48 | 49 | 50 | Setup for any OS (except Windows) 51 | ---------------- 52 | Create a directory. 53 | 54 | Place the files in the new directory. 55 | 56 | Run forGL by: 57 | IF you have Python 3.x installed 58 | python forGL.py dictionary_file 59 | 60 | //// Commented out, does not work with latest Java versions 61 | //// IF you have Java 6 or higher installed (Java 8 or higher recommended) 62 | //// java -jar forGL.jar dictionary_file 63 | 64 | Now you are ready to try various forGL features. 65 | Please see the Operations section below for more information. 66 | 67 | 68 | Windows setup 69 | ------------- 70 | Create a directory. 71 | 72 | Place the files in the new directory. 73 | 74 | ansicon.exe is needed to support Color Syntax Highlighting on Windows. 75 | If you are using another OS you can skip this part. 76 | 77 | For running on Windows, download ansicon 78 | This is the page of the version I use. 79 | http://adoxa.altervista.org/ansicon/ 80 | 81 | This is the link for ANSICON v1.87 82 | http://adoxa.altervista.org/ansicon/dl.php?f=ansicon 83 | 84 | Put the 2 DLL files (ANSI32 and ANSI64) and ansicon.exe in the same directory as you created. 85 | 86 | Start a Windows Cmd window. 87 | 88 | cd (to the directory you just created) 89 | 90 | type 91 | ansicon 92 | 93 | and you will see the title change to 94 | Cmd - ansicon 95 | 96 | Now if ANSI Escape sequences are sent by forGL 97 | the cursor will move and colored text will be seen. 98 | 99 | also type 100 | chcp 65001 101 | 102 | This changes the Windows text Code Page to UTF8 103 | You only need to do this 1 time 104 | but because I create / destroy Cmd.exe window instances often 105 | I suggest you create a .bat file with the following contents: 106 | 107 | @echo off 108 | chcp 65001 109 | python forGL.py 110 | 111 | Now if you do a dir command you should see: 112 | ANSI32.dll 113 | ANSI64.dll 114 | ansicon.exe 115 | forGL.jar (you may not have this, Python works as well) 116 | forGL.py 117 | forGL_Dictionary_Prototype.toml 118 | 119 | and the name of your new .bat file. 120 | 121 | 122 | 123 | 124 | Operations Quick Start 125 | ============================================================================== 126 | forGL has been tested on Windows 7 and 10 127 | 128 | but really : 129 | you can run forGL.py on any platform with Python 3.x installed 130 | 131 | 132 | forGL Dictionary (in memory and added to from a file) 133 | ------------------------------------------------------- 134 | forGL builds a default dictionary in memory of English words when starting. 135 | 136 | A (optional) dictionary file (such as forGL_Test.toml) 137 | can be used to add more words to the dictionary in memory. 138 | This allows you to add and run your own defintions of what forGL is to do. 139 | 140 | forGL tries to find a dictionary file named: forGL_Dictionary_Prototype.toml 141 | OR 142 | You can add the path and name of the dictionary file you want to use. 143 | 144 | 145 | Dictionary words in languages other than English 146 | ------------------------------------------------ 147 | forGL_Dictionary_Prototype.toml has examples of words in various languages. 148 | 149 | There is limited support (now) for non English languages: 150 | forGL messages are (now built in) in English. 151 | 152 | 153 | Dictionary file used by forGL 154 | ----------------------------- 155 | This is how you may add a command line argument for a dictionary file. 156 | (Python example) 157 | python forGL.py forGL_Test_Dictionary.toml 158 | 159 | Dictionary file use is optional but it is very nice to have and recommended. 160 | forGL has a minimum Dictionary that is built in. 161 | The minimum Dictionary is enough to run forGL and access all the features. 162 | 163 | 164 | 165 | ... Under Construction ... 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /src/forGL/Export.hx: -------------------------------------------------------------------------------- 1 | /* Export.hx forGL Export to a persistent Dictionary 2 | * 3 | * Prototype (VERY Experimental) of forGL application 4 | * 5 | * NOTES: 6 | * 7 | * Exporting from the Dictionary in memory to the Data layer 8 | * to allow persistent Dictionary changes. 9 | * 10 | * ... 11 | * @author Randy Maxwell 12 | */ 13 | 14 | package forGL; 15 | 16 | 17 | // Improved UTF8 support 18 | using hx.strings.Strings; 19 | using hx.strings.String8; 20 | 21 | using forGL.Parse.Parse; 22 | using forGL.Parse.NLToken; 23 | 24 | using forGL.NLTypes; 25 | import forGL.NLTypes.NLTypeAs.resolveType as resolveType; 26 | 27 | import forGL.Meanings.OpMeanings; 28 | import forGL.Meanings.MeansWhat.opMeanAsStr as opMeanAsStr; 29 | import forGL.Meanings.MeansWhat.returnMeanAsStr as returnMeanAsStr; 30 | 31 | import forGL.data.Data.ForGL_data; 32 | 33 | // import forGL.Dictionary.DictWord; 34 | import forGL.Dictionary.NLDictionary; 35 | 36 | import forGL.Meanings.ReturnMeanings; 37 | 38 | import forGL.UI.ForGL_ui.msg as msg; 39 | import forGL.UI.ForGL_ui.status as status; 40 | 41 | // Have Comments in Haxe generated output programming languages sources 42 | import forGL.Comments.comment as comment; 43 | 44 | using forGL.Export.NLExport; 45 | 46 | 47 | enum 48 | abstract ExportTypes(Int) { 49 | 50 | var EXPORT_TYPE_UNKNOWN = 0; 51 | 52 | var EXPORT_TYPE_DICTIONARY = 1; // 53 | 54 | } 55 | 56 | 57 | // 58 | // Import support for Dictionaries (or Library Vocabularies?) 59 | // 60 | class NLExport 61 | { 62 | 63 | public function new() 64 | { 65 | 66 | } 67 | 68 | 69 | public function init() 70 | { 71 | 72 | 73 | 74 | 75 | 76 | 77 | } 78 | 79 | 80 | 81 | public function cleanUp() 82 | { 83 | 84 | 85 | 86 | } 87 | 88 | 89 | // Export the in memory Dictionary to a file. 90 | // 91 | public var exportWords_msgs : String8 = ""; 92 | 93 | public var exportWords_replaced = 0; 94 | public var exportWords_added = 0; 95 | 96 | public function exportWords( dict : NLDictionary, dict_path_file : String8, data : ForGL_data, ?export_type = EXPORT_TYPE_DICTIONARY ) : ReturnMeanings 97 | { 98 | comment( "", "Export the in memory Dictionary to a file.", "" ); 99 | 100 | var result = RET_IS_OK; 101 | 102 | exportWords_msgs = ""; 103 | exportWords_replaced = 0; 104 | exportWords_added = 0; 105 | 106 | var words_replaced = new Array(); 107 | var words_added = new Array(); 108 | 109 | 110 | comment( "", "These are words that were Imported earlier.", "" ); 111 | var imported_words = data.getListOfWords( false ); // These are words that were Imported earlier. 112 | 113 | comment( "These are all the words a User has added/changed in the Dictionary" ); 114 | var out_words = dict.getCustomWords(); // These are all the words a User has added/changed in the Dictionary 115 | 116 | exportWords_msgs += "Information: " + Std.string( out_words.length ) + " words to Export.\n"; 117 | 118 | if ( 0 == out_words.length ) 119 | return RET_IS_OK; 120 | 121 | if ( 0 == imported_words.length ) 122 | { 123 | // TODO Create a new .toml file perhaps ? 124 | 125 | return RET_IS_NOT_IMPLEMENTED; 126 | } 127 | 128 | if ( 0 == dict.path_dictionary_file.length8() ) 129 | { 130 | exportWords_msgs += "INTERNAL ERROR: Export: No physical Dictionary file available to rename.\n"; 131 | return RET_IS_INTERNAL_ERROR; 132 | } 133 | 134 | var str = "Words to Export are: " + Std.string( out_words ) + "\n"; 135 | //msg( str ); 136 | exportWords_msgs += str; 137 | 138 | // TODO change to use Data layer or Dictionary for some of this 139 | 140 | var new_file_name = dict.path_dictionary_file; 141 | var extension = new_file_name.substr( new_file_name.length - 5, 5 ); 142 | 143 | var backup_name = new_file_name.substr( 0, new_file_name.length - extension.length8() ); 144 | 145 | comment( "Date and Time as part of name" ); 146 | var now_date = Date.now(); 147 | var date_raw = now_date.toString(); // YYYY-MM-DD HH:MM:SS format 148 | var date_str = ""; 149 | var i = 0; 150 | while ( i < date_raw.length ) 151 | { 152 | var char = date_raw.charAt( i ); 153 | if ( ( "-" == char ) 154 | || ( ":" == char ) ) 155 | date_str += "_"; 156 | else 157 | if ( " " == char ) 158 | date_str += "__"; 159 | else 160 | date_str += char; 161 | 162 | i++; 163 | } 164 | 165 | backup_name += "_Backup_" + date_str + extension; 166 | 167 | data.renameFile( dict.path_dictionary_file, backup_name ); 168 | 169 | var rInfo = new ResolveInfo(); 170 | 171 | var dict_idx = -1; 172 | 173 | i = 0; 174 | while ( i < out_words.length ) 175 | { 176 | dict_idx = dict.findWord( out_words[ i ] ); 177 | if ( dict_idx < 0 ) 178 | { 179 | // Just got a list of words from Dictionary. WHY is there a PROBLEM HERE? 180 | exportWords_msgs += "INTERNAL ERROR: findWord of " + out_words[ i ] + " was not found. Skipping to next word.\n"; 181 | i++; 182 | continue; 183 | } 184 | 185 | var dict_word : NLToken = dict.unique_Dictionary_Words[ dict_idx ]; 186 | 187 | rInfo.resolve_str = dict_word.token_str; 188 | rInfo.resolve_float = dict_word.token_float; 189 | rInfo.resolve_int = dict_word.token_int; 190 | rInfo.resolve_op_meaning = dict_word.token_op_means; 191 | rInfo.resolve_token_noun_data = dict_word.token_noun_data; 192 | rInfo.resolve_out_token = dict_word.internal_token; 193 | 194 | var replaceOrAdd_result = data.replaceOrAddWord( dict_word.visible_token, dict_word.token_type, rInfo ); 195 | 196 | if ( 0 == cast( replaceOrAdd_result, Int ) ) 197 | { 198 | if ( data.replaceOrAddWord_replaced ) 199 | { 200 | exportWords_replaced++; 201 | 202 | words_added.push( 0 ); 203 | words_replaced.push( 1 ); 204 | } 205 | else 206 | { 207 | exportWords_added++; 208 | 209 | words_added.push( 1 ); 210 | words_replaced.push( 0 ); 211 | } 212 | } 213 | else 214 | { 215 | result = replaceOrAdd_result; 216 | 217 | words_added.push( 0 ); 218 | words_replaced.push( 0 ); 219 | } 220 | 221 | i++; 222 | } 223 | 224 | var save_result = data.saveToFile( dict.path_dictionary_file ); 225 | 226 | if ( 0 != cast( save_result, Int ) ) 227 | { 228 | if ( RET_IS_OK == result ) 229 | result = save_result; 230 | } 231 | 232 | return result; 233 | } 234 | 235 | 236 | } -------------------------------------------------------------------------------- /src/forGL/ExportAs.hx: -------------------------------------------------------------------------------- 1 | /* ExportAs.hx forGL Export selected Verb(s) As other programming languages 2 | * 3 | * Exporting runtime information including 4 | * 5 | * the Dictionary in memory 6 | * 7 | * to allow using the words in your Dictionary as Haxe source file(s). 8 | * 9 | * ... 10 | * @author Randy Maxwell 11 | */ 12 | 13 | package forGL; 14 | 15 | // Improved UTF8 support 16 | using hx.strings.Strings; 17 | using hx.strings.String8; 18 | 19 | using forGL.Parse.Parse; 20 | using forGL.Parse.NLToken; 21 | 22 | using forGL.NLTypes; 23 | import forGL.NLTypes.NLTypeAs.resolveType as resolveType; 24 | 25 | import forGL.Meanings.OpMeanings; 26 | import forGL.Meanings.MeansWhat.opMeanAsStr as opMeanAsStr; 27 | import forGL.Meanings.MeansWhat.returnMeanAsStr as returnMeanAsStr; 28 | 29 | import forGL.data.Data.ForGL_data; 30 | 31 | // import forGL.Dictionary.DictWord; 32 | import forGL.Dictionary.NLDictionary; 33 | 34 | import forGL.Meanings.ReturnMeanings; 35 | 36 | import forGL.UI.ForGL_ui.msg as msg; 37 | import forGL.UI.ForGL_ui.status as status; 38 | 39 | // Have Comments in Haxe generated output programming languages sources 40 | import forGL.Comments.comment as comment; 41 | 42 | using forGL.ExportAs.NLExportAs; 43 | 44 | 45 | enum 46 | abstract ExportAsTypes(Int) { 47 | 48 | var EXPORT_AS_UNKNOWN = 0; 49 | 50 | var EXPORT_AS_HAXE = 1; // YES ! ! ! 51 | 52 | } 53 | 54 | 55 | // 56 | // Export support for Dictionaries (or Library Vocabularies?) 57 | // 58 | class NLExportAs 59 | { 60 | 61 | public function new() 62 | { 63 | 64 | } 65 | 66 | 67 | public function init( expRunMsgs : Array ) : ReturnMeanings 68 | { 69 | var retVal = RET_IS_OK; 70 | 71 | 72 | 73 | 74 | 75 | 76 | return retVal; 77 | } 78 | 79 | 80 | 81 | public function cleanUp() 82 | { 83 | 84 | 85 | 86 | } 87 | 88 | 89 | // Export a Verb just run as a programming language. 90 | // 91 | public var exportAsCode_msgs : String8 = ""; 92 | 93 | public var verbCount = 0; 94 | 95 | public var exportWords_replaced = 0; 96 | public var exportWords_added = 0; 97 | 98 | 99 | public function exportAsCode( dict : NLDictionary, dict_path_file : String8, data : ForGL_data, ?export_lang = EXPORT_AS_HAXE ) : ReturnMeanings 100 | { 101 | comment( "", "Export a Verb just run as a programming language.", "" ); 102 | 103 | var result = RET_IS_OK; 104 | 105 | exportAsCode_msgs = ""; 106 | 107 | var words_replaced = new Array(); 108 | var words_added = new Array(); 109 | 110 | 111 | exportAsCode_msgs += "Information: " + Std.string( verbCount ) + " Verbs to Export as .\n"; 112 | 113 | if ( 0 == verbCount ) 114 | return RET_IS_OK; 115 | 116 | comment( "", "These are words that were Imported earlier.", "" ); 117 | var imported_words = data.getListOfWords( false ); // These are words that were Imported earlier. 118 | 119 | if ( 0 == imported_words.length ) 120 | { 121 | // TODO Create a new .toml file perhaps ? 122 | 123 | return RET_IS_NOT_IMPLEMENTED; 124 | } 125 | 126 | if ( 0 == dict.path_dictionary_file.length8() ) 127 | { 128 | exportAsCode_msgs += "INTERNAL ERROR: Export: No physical Dictionary file available to rename.\n"; 129 | return RET_IS_INTERNAL_ERROR; 130 | } 131 | 132 | comment( "These are all the words a User has added/changed in the Dictionary" ); 133 | var out_words = dict.getCustomWords(); // These are all the words a User has added/changed in the Dictionary 134 | 135 | var str = "Verbs to Export as Code are: " + Std.string( out_words ) + "\n"; 136 | //msg( str ); 137 | exportAsCode_msgs += str; 138 | 139 | // TODO change to use Data layer or Dictionary for some of this 140 | 141 | var new_file_name = dict.path_dictionary_file; 142 | var extension = new_file_name.substr( new_file_name.length - 5, 5 ); 143 | 144 | var backup_name = new_file_name.substr( 0, new_file_name.length - extension.length8() ); 145 | 146 | comment( "Date and Time as part of name" ); 147 | var now_date = Date.now(); 148 | var date_raw = now_date.toString(); // YYYY-MM-DD HH:MM:SS format 149 | var date_str = ""; 150 | var i = 0; 151 | while ( i < date_raw.length ) 152 | { 153 | var char = date_raw.charAt( i ); 154 | if ( ( "-" == char ) 155 | || ( ":" == char ) ) 156 | date_str += "_"; 157 | else 158 | if ( " " == char ) 159 | date_str += "__"; 160 | else 161 | date_str += char; 162 | 163 | i++; 164 | } 165 | 166 | backup_name += "_Backup_" + date_str + extension; 167 | 168 | data.renameFile( dict.path_dictionary_file, backup_name ); 169 | 170 | var rInfo = new ResolveInfo(); 171 | 172 | var dict_idx = -1; 173 | 174 | i = 0; 175 | while ( i < out_words.length ) 176 | { 177 | dict_idx = dict.findWord( out_words[ i ] ); 178 | if ( dict_idx < 0 ) 179 | { 180 | // Just got a list of words from Dictionary. WHY is there a PROBLEM HERE? 181 | exportAsCode_msgs += "INTERNAL ERROR: findWord of " + out_words[ i ] + " was not found. Skipping to next word.\n"; 182 | i++; 183 | continue; 184 | } 185 | 186 | var dict_word : NLToken = dict.unique_Dictionary_Words[ dict_idx ]; 187 | 188 | rInfo.resolve_str = dict_word.token_str; 189 | rInfo.resolve_float = dict_word.token_float; 190 | rInfo.resolve_int = dict_word.token_int; 191 | rInfo.resolve_op_meaning = dict_word.token_op_means; 192 | rInfo.resolve_token_noun_data = dict_word.token_noun_data; 193 | rInfo.resolve_out_token = dict_word.internal_token; 194 | 195 | var replaceOrAdd_result = data.replaceOrAddWord( dict_word.visible_token, dict_word.token_type, rInfo ); 196 | 197 | if ( 0 == cast( replaceOrAdd_result, Int ) ) 198 | { 199 | if ( data.replaceOrAddWord_replaced ) 200 | { 201 | exportWords_replaced++; 202 | 203 | words_added.push( 0 ); 204 | words_replaced.push( 1 ); 205 | } 206 | else 207 | { 208 | exportWords_added++; 209 | 210 | words_added.push( 1 ); 211 | words_replaced.push( 0 ); 212 | } 213 | } 214 | else 215 | { 216 | result = replaceOrAdd_result; 217 | 218 | words_added.push( 0 ); 219 | words_replaced.push( 0 ); 220 | } 221 | 222 | i++; 223 | } 224 | 225 | var save_result = data.saveToFile( dict.path_dictionary_file ); 226 | 227 | if ( 0 != cast( save_result, Int ) ) 228 | { 229 | if ( RET_IS_OK == result ) 230 | result = save_result; 231 | } 232 | 233 | return result; 234 | } 235 | 236 | 237 | } -------------------------------------------------------------------------------- /src/forGL/data/Data.hx: -------------------------------------------------------------------------------- 1 | /* Data.hx This is the Data level interface of forGL 2 | * 3 | * Prototype (VERY Experimental) of forGL application 4 | * 5 | * NOTES: 6 | * See block comment at end of this file for more information. 7 | * 8 | * REQUIRES 9 | * LOCAL OS system style access to OS file system 10 | * OR 11 | * LOCAL Network (loopback IP) style access to LOCAL file system through a LOCAL minimal network (Web?) interface 12 | * OR 13 | * Network interface to REMOTE Data sources that provide persistent Data 14 | * 15 | * 16 | * so far Use LOCAL sys interface direct to file system 17 | * TODO put in ACCESS checks to file system and Network 18 | * 19 | * ... 20 | * @author Randy Maxwell 21 | */ 22 | 23 | package forGL.data; 24 | 25 | using Sys; 26 | 27 | //import haxe.Log; 28 | 29 | #if ! js 30 | import sys.FileSystem; 31 | import sys.io.File; 32 | import sys.io.FileOutput; 33 | #end 34 | 35 | import forGL.UI.ForGL_ui.msg as msg; 36 | import forGL.UI.ForGL_ui.error as error; 37 | 38 | // Improved UTF8 support 39 | using hx.strings.Strings; 40 | using hx.strings.String8; 41 | 42 | using forGL.NLTypes; 43 | 44 | import forGL.Meanings.ReturnMeanings; 45 | 46 | import forGL.FileTypes.FileTypes as FileTypes; 47 | 48 | import forGL.data.Toml.ForGL_toml as ForGL_toml; 49 | 50 | 51 | using forGL.data.Data.ForGL_data; 52 | 53 | 54 | // Data Interface to persistent data 55 | class ForGL_data 56 | { 57 | public function new() 58 | { 59 | } 60 | 61 | public var actual_path_file : String = ""; 62 | public var actual_file_type : FileTypes = FILE_IS_UNKNOWN; 63 | 64 | #if ( sys ) // Is stdout and File I/O available and various APIs ? 65 | // 66 | // 67 | // 68 | 69 | 70 | #else 71 | // Running in a Web browser or Flash or something like it. 72 | // Graphics mode output available but no direct file I/O. 73 | // Connecting to Local or Remote Data Store allows file I/O 74 | // or connect to a Logging utility (Local or Remote) 75 | // If NO Local or Remote connection wanted, still can run as "Super Calculator" 76 | // just NO persistent data will be saved 77 | 78 | 79 | #end 80 | 81 | private var data_call_count = 0; 82 | 83 | private var toml : ForGL_toml; 84 | 85 | 86 | public function callCount() : Int 87 | { 88 | return data_call_count; 89 | } 90 | 91 | /* Initialize Data file handling */ 92 | public function init( path_file : String, file_type : FileTypes ) : ReturnMeanings 93 | { 94 | var result = RET_IS_OK; 95 | 96 | data_call_count++; 97 | 98 | #if ( sys || js ) 99 | toml = new ForGL_toml(); 100 | 101 | result = loadFile( path_file, file_type ); 102 | 103 | 104 | 105 | #else 106 | 107 | result = RET_IS_NOT_IMPLEMENTED; 108 | 109 | 110 | #end 111 | 112 | return result; 113 | } 114 | 115 | 116 | /* Clean up Data file handling */ 117 | public function cleanUp() : ReturnMeanings 118 | { 119 | var ret_val = RET_IS_OK; 120 | 121 | #if ( sys ) 122 | 123 | try 124 | { 125 | toml.cleanUp(); 126 | 127 | 128 | 129 | 130 | } 131 | catch ( e:Dynamic ) 132 | { 133 | error( "\nINTERNAL ERROR: Exception in forGL_data.cleanUp(): " + Std.string( e ) + " \n"); 134 | 135 | ret_val = RET_IS_INTERNAL_ERROR; 136 | }; 137 | 138 | #end 139 | 140 | return ret_val; 141 | } 142 | 143 | 144 | // Load all or part of a file into memory 145 | // 146 | public function loadFile( path_name : String, expected_type : FileTypes ) : ReturnMeanings 147 | { 148 | var ret_val = RET_IS_OK; 149 | 150 | // TODO sometime add support for other files: TXT or LOG or SQL or XML or JSON files 151 | 152 | if ( FILE_IS_DICTIONARY == expected_type ) 153 | { 154 | // Make sure this is has .toml file extension 155 | var extension = path_name.substr( path_name.length - 5, 5 ); 156 | if ( ".toml" != extension.toLowerCase() ) 157 | { 158 | error( "ERROR: File extension not .toml : " + path_name + " " + extension + "\n" ); 159 | 160 | ret_val = RET_IS_USER_ERROR_DATA; 161 | } 162 | else 163 | { 164 | ret_val = toml.init( path_name, expected_type ); // Start up toml file handler 165 | 166 | if ( ReturnMeanings.RET_IS_OK == ret_val ) 167 | { 168 | actual_file_type = toml.actual_file_type; 169 | actual_path_file = toml.actual_path_file; 170 | } 171 | } 172 | } 173 | 174 | return ret_val; 175 | } 176 | 177 | 178 | // Get List of words (returns visible names) 179 | // 180 | public function getListOfWords( ?warn_if_not_unique = true ) : Array 181 | { 182 | var wordList = toml.getWordList( warn_if_not_unique ); 183 | 184 | return wordList; 185 | } 186 | 187 | 188 | // Get details about a word 189 | // 190 | public var findWordDef_type = NL_TYPE_UNKNOWN; 191 | 192 | public function findWordDef( word_visible_name : String8, rInfo : ResolveInfo ) : ReturnMeanings 193 | { 194 | findWordDef_type = NL_TYPE_UNKNOWN; 195 | 196 | var ret_val = toml.getWord( word_visible_name, rInfo ); 197 | 198 | if ( 0 == cast( ret_val, Int ) ) 199 | { 200 | findWordDef_type = toml.getWord_type; 201 | } 202 | 203 | return ret_val; 204 | } 205 | 206 | 207 | // Allow upper level code to see lower level errors 208 | public function getDataErrors() : Array 209 | { 210 | return toml.error_msgs; 211 | } 212 | 213 | 214 | // Allow upper level code to see lower level errors 215 | public function getDataWarnings() : Array 216 | { 217 | return toml.warning_msgs; 218 | } 219 | 220 | 221 | // Renames a file to a new path and name 222 | // 223 | public function renameFile( old_path_name : String, new_path_name : String ) : ReturnMeanings 224 | { 225 | var ret_val = RET_IS_OK; 226 | try 227 | { 228 | #if ! js 229 | FileSystem.rename( old_path_name, new_path_name ); 230 | #end 231 | } 232 | catch ( e : Dynamic ) 233 | { 234 | // Perhaps the new_path_name already exists? 235 | 236 | // msg( "\nException in renameFile(): " + Std.string( e ) + " \n"); 237 | ret_val = RET_IS_INTERNAL_ERROR; 238 | }; 239 | 240 | return ret_val; 241 | } 242 | 243 | 244 | // Save Data to a File at a path and name 245 | // 246 | public function saveToFile( new_path_name : String ) : ReturnMeanings 247 | { 248 | var save_result = toml.saveData( new_path_name ); 249 | 250 | return save_result; 251 | } 252 | 253 | 254 | // Replace contents or Add a new word 255 | // 256 | public var replaceOrAddWord_replaced = false; 257 | 258 | public function replaceOrAddWord( word_visible_name : String8, word_type : NLTypes, rInfo : ResolveInfo ) : ReturnMeanings 259 | { 260 | replaceOrAddWord_replaced = false; 261 | 262 | var replaceOrAdd_result = toml.changeOrAddWord( word_visible_name, word_type, rInfo ); 263 | 264 | if ( 0 == cast( replaceOrAdd_result, Int ) ) 265 | { 266 | 267 | replaceOrAddWord_replaced = toml.changeOrAddWord_changed; 268 | } 269 | 270 | return replaceOrAdd_result; 271 | } 272 | 273 | } 274 | -------------------------------------------------------------------------------- /src/forGL/Comments.hx: -------------------------------------------------------------------------------- 1 | package forGL; 2 | // Above: Use the same package name as where this code is used. Change to fit your needs 3 | /* 4 | * Comments.hx This supports Haxe inserting Comments in various output target programming languages. 5 | * 6 | * THANKS to Haxe Forum members 7 | * 8 | * Information here is correct about Haxe up to 4.0 rc2 9 | * 10 | * GOAL: 11 | * Allow Haxe source code to have a way to put Comments in the generated programming language. 12 | * 13 | * Some generated language sources are not useful for inserting Comments. 14 | * CppIA, HashLink and Neko are examples. 15 | * 16 | * BACKGROUND: 17 | * Haxe compiler (as of 4.0 rc2) does Not support placing Comments from Haxe into target languages. 18 | * There is some support of Comments for some target languages, but not all. 19 | * And where you see actual Comments the support seems to be mostly to enable Debugging at Haxe source level. 20 | * So actually where you see Comments seem to also be limited to inside code and Not anywhere in the source file. 21 | * 22 | * For more background see: 23 | * https://community.haxe.org/t/how-to-have-comments-in-haxe-be-in-target-languages/1501 24 | * 25 | * LIMITATION: 26 | * Because the Haxe macro approach is used to insert a Comment: 27 | * Comments can ONLY be inserted from places where a Haxe macro may be used. 28 | * So Comments are ONLY allowed within code and not other places in the target language source files. 29 | * 30 | * SOLUTION: 31 | * Approach is noted in detail below. 32 | */ 33 | 34 | 35 | /** 36 | * @author Haxe Forum members 37 | */ 38 | 39 | import haxe.macro.Expr; 40 | import haxe.macro.Context; 41 | 42 | class Comments 43 | { 44 | // Insert a Comment OR multiple lines of Comments into a Haxe target programming language. 45 | // 46 | // Example: 47 | // comment( "Describe WHY this is important", "", " Alternate approaches to What is going on" ); 48 | // The second line will look like a blank line. 49 | // 50 | // Output looks like: 51 | // 52 | // Describe WHY this is important ; 53 | // ; 54 | // Alternate approaches to What is going on ; 55 | // 56 | // You may use as many quoted strings as you want, each quoted string will be on a separate line. 57 | // 58 | macro public static function comment( first : Expr, rest : Array< Expr > ) : Expr 59 | { 60 | 61 | // 62 | // HACK to avoid macro errors FROM Haxe 4.2.4 or later ? 63 | // 64 | // 65 | 66 | // DISABLE COMMENTS FROM BEING OUTPUT 67 | 68 | var cmts = [ macro $v{ '' } ]; 69 | return macro $b{ cmts }; 70 | 71 | 72 | 73 | 74 | // create a Default Warning as an array of just 1 macro Expression 75 | // idea from https://code.haxe.org/category/macros/build-arrays.html 76 | // 77 | // NOTE: the Default is of the format style for C family of Comments. 78 | // May produce a Compiler Error if target language has different format style of Comments. 79 | var cmts = [ macro $v{ '/* Target programming language not checked for in Comments class ! */' } ]; 80 | 81 | // Languages checked for in Alphabetical order 82 | 83 | // Approach: All the below use the Single Line comment style of the given target programming language 84 | // Haxe adds a semicolon ( ; ) after inserting the macro Expression(s), (may not be true for all languages). 85 | // As Single Line comment style was used, the ending semicolon is included as part of the inserted comment. 86 | // This allows Haxe to tell that this is really a Comment. 87 | // 88 | // Looking at above Example the only visual clutter seems to be a vertical line of semicolons spaced out to the right. 89 | // This approach successfully supports READABLE Comments in various Haxe target programming languages. 90 | 91 | if ( Context.defined( "cppia" ) ) // C++ Instructions Assembly extension, set to be empty 92 | cmts = [ first ].concat( rest ).map( extractNoPadding ).map( x -> macro untyped __cppia__( '' ) ); 93 | 94 | else 95 | if ( Context.defined( "cpp" ) ) // C++ 96 | cmts = [ first ].concat( rest ).map( extract ).map( x -> macro untyped __cpp__( '// $x ' ) ); 97 | 98 | else 99 | if ( Context.defined( "cs" ) ) // C# ( CSharp ) 100 | cmts = [ first ].concat( rest ).map( extract ).map( x -> macro untyped __cs__( '// $x ' ) ); 101 | 102 | else 103 | if ( Context.defined( "fl" ) ) // Flash 104 | cmts = [ first ].concat( rest ).map( extract ).map( x -> macro untyped __fl__( '// $x ' ) ); 105 | 106 | else 107 | if ( Context.defined( "hl" ) ) // HashLink set to be empty return 108 | cmts = [ first ].concat( rest ).map( extractNoPadding ).map( x -> macro untyped __hl__( '' ) ); 109 | 110 | else 111 | if ( Context.defined( "java" ) ) 112 | cmts = [ first ].concat( rest ).map( extract ).map( x -> macro untyped __java__( '// $x ' ) ); 113 | 114 | else 115 | if ( Context.defined( "js" ) ) // JavaScript 116 | cmts = [ first ].concat( rest ).map( extract ).map( x -> macro js.Syntax.code( '// $x ' ) ); 117 | 118 | else 119 | if ( Context.defined( "lua" ) ) 120 | cmts = [ first ].concat( rest ).map( extract ).map( x -> macro untyped __lua__( '-- $x ' ) ); 121 | 122 | else 123 | if ( Context.defined( "neko" ) ) // Neko set to be empty return 124 | cmts = [ first ].concat( rest ).map( extractNoPadding ).map( x -> macro untyped __neko__( '' ) ); 125 | 126 | else 127 | if ( Context.defined( "python" ) ) // Python 128 | cmts = [ first ].concat( rest ).map( extractNoPadding ).map( x -> macro python.Syntax.code( '# $x' ) ); 129 | 130 | else 131 | if ( Context.defined( "php" ) ) // PHP 132 | cmts = [ first ].concat( rest ).map( extract ).map( x -> macro php.Syntax.code( '# $x ' ) ); 133 | else 134 | { 135 | // Default already assigned. 136 | } 137 | 138 | return macro $b{ cmts }; 139 | } 140 | 141 | // Check that a simple string is used as input. 142 | // The string is padded on the right to a width of 80 with Blank spaces. 143 | // The padding supports better READABILITY of the inserted Comment(s). 144 | static function extract( e : Expr ) return 145 | switch e.expr { 146 | case EConst( CString( v ) ): 147 | var temp = v; 148 | if ( temp.length < 80 ) 149 | { 150 | var str80 = " "; 151 | temp = temp + str80.substr( 0, str80.length - temp.length ); 152 | } 153 | temp; 154 | case _: "not a proper Comment"; 155 | } 156 | 157 | 158 | // Check that a simple string is used as input. 159 | static function extractNoPadding( e : Expr ) return 160 | switch e.expr { 161 | case EConst( CString( v ) ): 162 | var temp = v; 163 | 164 | // TODO: Python for example will have 2 extra Blank spaces at end (Right side) that should be trimmed 165 | 166 | 167 | temp; 168 | case _: "not a proper Comment 2"; 169 | } 170 | } -------------------------------------------------------------------------------- /src/forGL/NLImport.hx: -------------------------------------------------------------------------------- 1 | /* NLImport.hx forGL Import into Dictionary in memory interface 2 | * 3 | * Prototype (VERY Experimental) of forGL application 4 | * 5 | * NOTES: 6 | * 7 | * Support adding somewhat validated words from the Data layer to a Dictionary in memory. 8 | * 9 | * ... 10 | * @author Randy Maxwell 11 | */ 12 | 13 | package forGL; 14 | 15 | 16 | // Improved UTF8 support 17 | using hx.strings.Strings; 18 | using hx.strings.String8; 19 | 20 | using forGL.NLTypes; 21 | import forGL.NLTypes.NLTypeAs.resolveType as resolveType; 22 | 23 | import forGL.Meanings.OpMeanings; 24 | import forGL.Meanings.MeansWhat.opMeanAsStr as opMeanAsStr; 25 | import forGL.Meanings.MeansWhat.returnMeanAsStr as returnMeanAsStr; 26 | 27 | import forGL.data.Data.ForGL_data; 28 | 29 | import forGL.Dictionary.NLDictionary; 30 | 31 | import forGL.Meanings.ReturnMeanings; 32 | 33 | 34 | import forGL.UI.ForGL_ui.msg as msg; 35 | import forGL.UI.ForGL_ui.error as error; 36 | import forGL.UI.ForGL_ui.status as status; 37 | 38 | // Allow Comments in Haxe generated output programming languages sources 39 | import forGL.Comments.comment as comment; 40 | 41 | using forGL.NLImport.NLImport; 42 | 43 | // 44 | // Import support for Dictionaries (or Library Vocabularies?) 45 | // 46 | class NLImport 47 | { 48 | 49 | public function new() 50 | { 51 | 52 | } 53 | 54 | 55 | public function init() 56 | { 57 | 58 | } 59 | 60 | 61 | 62 | public function cleanUp() 63 | { 64 | 65 | } 66 | 67 | public var importWords_msgs : String8 = ""; 68 | 69 | public function importWords( data : ForGL_data, dict : NLDictionary, dict_path_file : String8 /*, do_OEM = false */ ) : ReturnMeanings 70 | { 71 | comment("","Support adding somewhat validated words from the Data layer to a Dictionary in memory.",""); 72 | 73 | var result = RET_IS_OK; 74 | 75 | importWords_msgs = ""; 76 | 77 | // TODO Check that path/name matches for both dictionary and data 78 | 79 | 80 | var words = data.getListOfWords(); 81 | importWords_msgs += "Information: " + Std.string( words.length ) + " words to import.\n"; 82 | 83 | if ( 0 == words.length ) 84 | return RET_IS_OK; 85 | 86 | var next_word : String8 = ""; 87 | var words_str = words[ 0 ]; 88 | 89 | // if ( do_OEM ) 90 | // Change to OEM characters ONLY for display. NOT for comparison with internal UTF8. 91 | // words_str = Utf8_to_OEM.oemStr( words_str ); 92 | 93 | var i = 0; 94 | var line_len = 0; 95 | while ( i < words.length ) 96 | { 97 | next_word = words[ i ]; 98 | 99 | // if ( do_OEM ) 100 | // next_word = Utf8_to_OEM.oemStr( next_word ); 101 | 102 | 103 | i++; 104 | 105 | // Limit string length of exported words per line 106 | if ( ( line_len + next_word.length ) > 77 ) 107 | { 108 | // Too long so move to next line and set length 109 | words_str += ", \n" + next_word; 110 | line_len = next_word.length; 111 | } 112 | else 113 | { 114 | words_str += ", " + next_word; 115 | line_len += 2 + next_word.length; 116 | } 117 | } 118 | 119 | var str = "Words to Import are:\n" + words_str + "\n"; 120 | importWords_msgs += str; 121 | 122 | var rInfo = new ResolveInfo(); 123 | 124 | var rOtherInfo = new ResolveInfo(); 125 | 126 | var find_result = RET_IS_OK; 127 | 128 | i = 0; 129 | while ( i < words.length ) 130 | { 131 | find_result = data.findWordDef( words[ i ], rInfo ); 132 | //status( words[ i ] + " " + rInfo.resolve_out_token + " " + opMeanAsStr( rInfo.resolve_op_meaning ), RED, false, true ); 133 | 134 | if ( RET_IS_OK != find_result ) 135 | { 136 | // Just got a list of words. WHY is there a PROBLEM HERE? 137 | importWords_msgs += "INTERNAL ERROR: findWordDef of " + words[ i ] + " has unexpected result of " + returnMeanAsStr( find_result ) + ". Skipping to next word.\n"; 138 | i++; 139 | continue; 140 | } 141 | 142 | // The SPELLING of the word at the VISIBLE LEVEL MUST BE UNIQUE. 143 | // So use lower case of word for comparisons. 144 | if ( 0 == rInfo.resolve_out_token.length8() ) 145 | rInfo.resolve_out_token = Strings.toLowerCase8( words[ i ] ); 146 | 147 | rInfo.resolve_use_out = true; 148 | 149 | // var dictIdx = dict.findWord( rInfo.resolve_out_token, words[ i ] ); 150 | var dictIdx = dict.findWord( words[ i ] ); 151 | 152 | if ( ( NL_OPERATOR == data.findWordDef_type ) 153 | && ( OP_IS_UNKNOWN == rInfo.resolve_op_meaning ) ) 154 | { 155 | var resolve_result = resolveType( rInfo.resolve_out_token, rOtherInfo, false, false ); 156 | 157 | if ( NL_OPERATOR == resolve_result ) 158 | { 159 | rInfo.resolve_op_meaning = rOtherInfo.resolve_op_meaning; 160 | rInfo.resolve_out_token = rOtherInfo.resolve_out_token; 161 | } 162 | else 163 | { 164 | comment( "", "Dictionary may have a reference to a Built In Verb rather than an Operator", 165 | "Example: 'zeigen' is German for 'show' (changed '' to ' for easy reading here)", 166 | "[_zeigen_]", 167 | "word_type = 'operator'", 168 | "name = 'zeigen'", 169 | "built_in_name = 'show'", "", 170 | "The above call to resolveType should have set resolve_result to NL_VERB_BI", ""); 171 | if ( NL_VERB_BI == resolve_result ) 172 | { 173 | rInfo.resolve_op_meaning = rOtherInfo.resolve_op_meaning; 174 | rInfo.resolve_out_token = rOtherInfo.resolve_out_token; 175 | 176 | comment( "We know this really is a Built In Verb" ); 177 | data.findWordDef_type = NL_VERB_BI; 178 | } 179 | else 180 | { 181 | 182 | // Unable to resolve the details of the Operator type. Strange... 183 | var err_msg = "INTERNAL ERROR: Word " + words[ i ] + " unable to resolve details of Operator type. Skipping to next word.\n"; 184 | importWords_msgs += err_msg; 185 | error( err_msg ); 186 | i++; 187 | continue; 188 | } 189 | } 190 | } 191 | 192 | if ( NL_OPERATOR == data.findWordDef_type ) 193 | { 194 | var built_in_op_str = opMeanAsStr( rInfo.resolve_op_meaning, true ); 195 | rInfo.resolve_out_token = built_in_op_str; 196 | } 197 | 198 | if ( NL_NOUN == data.findWordDef_type ) 199 | { 200 | rInfo.resolve_op_meaning = OP_IS_UNKNOWN; 201 | 202 | // Have actual data type of Noun be correct with the data. 203 | if ( NL_STR == rInfo.resolve_token_noun_data ) 204 | { 205 | rInfo.resolve_float = 0.0; 206 | rInfo.resolve_int = 0; 207 | 208 | var resolve_result = resolveType( rInfo.resolve_str, rOtherInfo, false, true ); 209 | if ( ( NL_TYPE_UNKNOWN != resolve_result ) 210 | && ( NL_STR != resolve_result ) ) 211 | { 212 | rInfo.resolve_token_noun_data = resolve_result; 213 | rInfo.resolve_str = ""; 214 | 215 | switch ( resolve_result ) 216 | { 217 | case NL_BOOL: 218 | rInfo.resolve_int = rOtherInfo.resolve_int; 219 | case NL_INT: 220 | rInfo.resolve_int = rOtherInfo.resolve_int; 221 | case NL_FLOAT: 222 | rInfo.resolve_float = rOtherInfo.resolve_float; 223 | default: 224 | var err_msg = "INTERNAL ERROR: importWords " + words[ i ] + " Unexpected resolve result. Skipping to next Word.\n"; 225 | 226 | importWords_msgs += err_msg; 227 | error( err_msg, RED ); 228 | i++; 229 | continue; 230 | } 231 | } 232 | } 233 | } 234 | 235 | if ( NL_VERB == data.findWordDef_type ) 236 | { 237 | rInfo.resolve_token_noun_data = NL_TYPE_UNKNOWN; 238 | rInfo.resolve_op_meaning = OP_IS_UNKNOWN; 239 | rInfo.resolve_float = 0.0; 240 | rInfo.resolve_int = 0; 241 | } 242 | 243 | if ( 0 <= dictIdx ) 244 | { 245 | // Word already in Dictionary. Does Dictionary allow Replacement 246 | var replace_result = dict.addWord( words[ i ], data.findWordDef_type, 247 | rInfo.resolve_out_token, rInfo.resolve_op_meaning, 248 | rInfo.resolve_str, rInfo.resolve_float, 249 | rInfo.resolve_int, rInfo.resolve_token_noun_data, 250 | dictIdx ); 251 | 252 | if ( ( 0 != cast( replace_result, Int ) ) 253 | || ( 0 < dict.addWord_msg.length ) ) 254 | { 255 | status( Std.string( rInfo ) ); 256 | status( dict.addWord_msg ); 257 | } 258 | 259 | result = replace_result; 260 | } 261 | else 262 | { 263 | var add_result = dict.addWord( words[ i ], data.findWordDef_type, 264 | rInfo.resolve_out_token, rInfo.resolve_op_meaning, 265 | rInfo.resolve_str, rInfo.resolve_float, 266 | rInfo.resolve_int, rInfo.resolve_token_noun_data ); 267 | 268 | if ( ( 0 != cast( add_result, Int ) ) 269 | || ( 0 < dict.addWord_msg.length ) ) 270 | { 271 | status( Std.string( rInfo ) ); 272 | status( dict.addWord_msg ); 273 | } 274 | 275 | result = add_result; 276 | } 277 | i++; 278 | } 279 | 280 | if ( 0 < words.length ) 281 | { 282 | dict.sortDictionary(); 283 | } 284 | 285 | return result; 286 | } 287 | 288 | 289 | } -------------------------------------------------------------------------------- /Tests/forGL_Test.toml: -------------------------------------------------------------------------------- 1 | # This is a forGL dictionary as a TOML document. (Prototype version of forGL) 2 | # 3 | # .toml is the required file extension to avoid some parse problems 4 | # 5 | # UTF8 character encoding is required 6 | # 7 | # User viewpoint: Definitions of forGL words in the dictionary act 8 | # like Nouns and Verbs (and other Natural Language or Math ideas) ... 9 | # forGL Library viewpoint: like Data and Code and Math operators, ... 10 | 11 | # Required: 12 | # Must be the first section of a dictionary 13 | [forGL_dictionary] 14 | 15 | # This is the number of times that this dictionary file has been saved with 1 or more changes. 16 | content_change_number = 0 17 | 18 | # Required: 19 | # Version of the way of representing a forGL dictionary. Semantic version 2 approach 20 | # If you want to track how many times content within a specific dictionary changes 21 | # see: forGL_dictionary.content_change_number above 22 | # 23 | [version] 24 | version = 0.0.1.Alpha 25 | 26 | # Optional: 27 | # Hint about Natural Language name. Must be English name of Language. 28 | [language] 29 | natural_language = English 30 | 31 | # Optional: 32 | # This is to allow new languages to be defined that are not part of already built in language support. 33 | # Maybe a language from a book or cinema (movie) or game? 34 | # 35 | # If you have a natural_language like German or Spanish 36 | # then these settings are ignored because the reading_order is already known. 37 | # 38 | # Also for Mathematics the reading_order is set as Left to Right and Top to Bottom 39 | # 40 | # Reading order: Left to Right and Top to Bottom OR Right to Left and Top to Bottom 41 | [reading_order] 42 | left_to_right = true 43 | top_to_bottom = true 44 | 45 | 46 | # Optional: 47 | [money] 48 | monetary_unit_symbol = "$" 49 | 50 | # Optional: 51 | [decimal] 52 | decimal_point = "." 53 | 54 | #Optional: 55 | [thousands] 56 | thousands_sep = "," 57 | 58 | 59 | # Information needed to define a word: 60 | # 61 | # Name (required and must be unique in spelling) 62 | # 63 | # The first character of any name must Not be a number digit (0 to 9). 64 | # Other number digits may also be invalid for languages that use them. 65 | # 66 | # A name must Not have: 67 | # any blank space or tab character 68 | # any \ (back slash) or newline (carriage Return or Line Feed) character 69 | # 70 | # A User defined name must Not contain: 71 | # reserved Mathematics, Logical, Grouping operators or Punctuation characters. 72 | # + - * / % < <= == = > >= ! ? != ( ) [ ] { } . , ; : ... 73 | # All of the above are invalid for User defined names 74 | # as they are already being used by forGL. 75 | # 76 | # If this is any User defined name you may have any combination of 77 | # other valid UTF8 characters that follow the above requirements. 78 | # 79 | # You are not limited to using only characters within a specific natural language. 80 | # 81 | # Type (required and must be: Noun or Verb or Operator or Choice) 82 | # 83 | # A Noun must have a value such as: 84 | # a quoted string "Hi there! " 85 | # a number such as: 3.5 or 11 or 1.7654e5 or 0xf001 86 | # a Bool which will may be either true or false 87 | # 88 | # Any Noun as a defined word in a dictionary must have a value. 89 | # 90 | # A Verb is a definition of some action(s) that are wanted. 91 | # Constants like a specific string, number or Bool value 92 | # are found in verb definitions. 93 | # 94 | # Verb(s) can also use what looks like a Noun that is not defined. 95 | # Undefined Nouns are used locally within the verb and 96 | # are not available in other verbs. These are called local nouns. 97 | # 98 | # Operator(s) are similar to verb(s) that are limited to one possible action. 99 | # Provided operator(s) use 0, 1 or 2 data items (Nouns or constants) 100 | # 101 | # There are some already defined words that help with some common tasks. 102 | # These are called Built In Verbs: 103 | # repeat 104 | # show 105 | # view 106 | # 107 | # Built In Name (Required only for Operators. Must be in English) 108 | # 109 | # value (Required for Nouns and Verbs) 110 | # 111 | # Nouns: value Examples 112 | # value = 5 (integer number) 113 | # value = 0x15 (integer as Hexadecimal = 21 here) 114 | # value = 5.7654e2 (scientific notation for floating point number = 576.54) 115 | # value = true (Boolean) 116 | # value = "Having a wonderful time. Wish you were here." (string) 117 | # value = "" (a string that has no text characters, an empty string) 118 | # value = """Having 119 | # a 120 | # wonderful 121 | # time.""" (multi-line string as 4 lines) 122 | # 123 | # Verbs: value Examples 124 | # MAY be multi-line strings of the definition. 125 | # Multi-line strings start and end with 3 double Quote characters. 126 | # 3 double Quote characters allow quoted strings inside a verb. 127 | # value = """"Hi there! " = y. y show.""" 128 | # value = """45 radians = x. sin(x)/cos(x) show""" 129 | # value = "" 130 | # 131 | # value = """blat equals 32. 132 | # blat times 0x12. 133 | # show 1000 REPEAT""" 134 | # 135 | # OR 136 | # Use only 1 double Quote character if there will be NO inside quoted strings. 137 | # value = "x = 45 radians. sin(x)/cos(x) show" 138 | # 139 | # Operators that use 2 Data items 140 | # 141 | 142 | # Arithmetic 143 | # 144 | # This must be unique in spelling. Wrong to have [_PLUS] and later [_plus] 145 | [_Plus] 146 | # Must be: noun, verb, operator, or choice 147 | word_type = "operator" 148 | 149 | # Must be unique in spelling. Change "plus" to support any language. 150 | name = "plus" 151 | 152 | # Do Not change this Built In Operator name 153 | built_in_name = "+" 154 | 155 | 156 | [_Minus] 157 | word_type = "operator" 158 | name = "minus" 159 | built_in_name = "-" 160 | 161 | 162 | [_Multiply] 163 | word_type = "operator" 164 | name = "multiply" 165 | built_in_name = "*" 166 | 167 | 168 | [_Divide] 169 | word_type = "operator" 170 | name = "divide" 171 | built_in_name = "/" 172 | 173 | 174 | [Modulo] 175 | word_type = "operator" 176 | name = "modulo" 177 | built_in_name = "%" 178 | 179 | [Decrement] 180 | word_type = "operator" 181 | name = "decrement" 182 | built_in_name = "--" 183 | 184 | [Increment] 185 | word_type = "operator" 186 | name = "increment" 187 | built_in_name = "++" 188 | 189 | # Comparison (these need 2 Data items, result is Bool: true or false) 190 | # 191 | [Is_Equal] 192 | word_type = "operator" 193 | name = "isEqual" 194 | built_in_name = "==" 195 | 196 | [Is_Not_Equal] 197 | word_type = "operator" 198 | name = "notEqual" 199 | built_in_name = "!=" 200 | 201 | [Is_Less_Than] 202 | word_type = "operator" 203 | name = "lessThan" 204 | built_in_name = "<" 205 | 206 | [Is_Less_Or_Equal] 207 | word_type = "operator" 208 | name = "lessOrEqual" 209 | built_in_name = "<=" 210 | 211 | [Is_Greater_Than] 212 | word_type = "operator" 213 | name = "greaterThan" 214 | built_in_name = ">" 215 | 216 | [Is_Greater_Or_Equal] 217 | word_type = "operator" 218 | name = "greaterOrEqual" 219 | built_in_name = ">=" 220 | 221 | # Choice 222 | # 223 | word_type = "choice" 224 | name = "If" 225 | built_in_name = "if" 226 | 227 | 228 | 229 | # Mathematics 230 | # 231 | 232 | # Uncomment this to see a message about a non Unique word 233 | #[Modulo] 234 | #word_type = "operator" 235 | #name = "modulo" 236 | #built_in_name = "%" 237 | 238 | [limit] 239 | word_type = "noun" 240 | name = "limit" 241 | value = 7 242 | 243 | [n1] 244 | word_type = "noun" 245 | name = "n1" 246 | value = 7 247 | 248 | [result] 249 | word_type = "noun" 250 | name = "result" 251 | value = 0 252 | 253 | [factorial] 254 | word_type = "verb" 255 | # Put a number on the Data stack (like 5) to find the factorial. 256 | name = "factorial" 257 | value = into L. 1. into p. 1 into i. while ( i <= L ){ p * i into p. i + 1 into i.} p. 258 | 259 | [Faktorial] 260 | word_type = "verb" 261 | # Legen Sie eine Nummer auf den Datenstapel (wie 5), um das Faktorial zu finden. 262 | name = "Faktorial" 263 | value = geht L. 1. geht p. 1 geht i. Während(i<=L){p*i geht p. i+1 geht i} p. 264 | 265 | [fib] 266 | word_type = "verb" 267 | # Put a number on the Data stack (like 7) if you want the 8th Fibonacci number. 268 | # This counts from 0 instead of 1 for the number you give. So 0 would give the 1st. 269 | name = "Fib" 270 | value = into L.if ( 0 == L ) { 0 return } 271 | if ( 2 <= L ) { 1 return } 272 | 1 into p. 273 | 2 into q. 274 | p + q into f. 275 | 3 into n. 276 | while ( n <= L ) 277 | { 278 | p + q into f. 279 | q into p. 280 | f into q. 281 | n + 1 into n. 282 | n show. 283 | } 284 | f 285 | if ( 0 == L ) { 0 return } 286 | if ( 2 <= L ) { 1 return } 287 | 1 into p. 288 | 2 into q. 289 | p + q into f. 290 | 3 into n. 291 | while ( n <= L ) 292 | { 293 | p + q into f. 294 | q into p. 295 | f into q. 296 | n + 1 into n. 297 | n show. 298 | } 299 | f 300 | 301 | [v1] 302 | word_type = "verb" 303 | name = "v1" 304 | value = 5 =: n1. n1 show 305 | 306 | [_from_] 307 | word_type = "operator" 308 | name = "from" 309 | built_in_name = ":=" 310 | 311 | [_into_] 312 | word_type = "operator" 313 | name = "into" 314 | built_in_name = "=:" 315 | 316 | [_TEST_FACTORIAL_] 317 | word_type = "verb" 318 | name = "TEST_FACTORIAL" 319 | value = into L. 1 into I. while(I<=L){I factorial. " " + show. I+1 into I} 320 | 321 | [_TEST_FIB_] 322 | word_type = "verb" 323 | name = "TEST_FIB" 324 | value = into L. 1 into I. while(I<=L){I Fib. " " + show. I+1 into I} 325 | 326 | [_glücklich_] 327 | word_type = "noun" 328 | name = "glücklich" 329 | value = "glücklich ist besser" 330 | 331 | [_feliz_] 332 | word_type = "noun" 333 | name = "feliz" 334 | value = "feliz es mejor" 335 | 336 | [_heureux_] 337 | word_type = "noun" 338 | name = "heureux" 339 | value = "heureux c'est mieux" 340 | 341 | [_felice_] 342 | word_type = "noun" 343 | name = "felice" 344 | value = "felice è meglio" 345 | 346 | [_happy_] 347 | word_type = "noun" 348 | name = "happy" 349 | value = "happy is better" 350 | 351 | [_geht_] 352 | word_type = "operator" 353 | name = "geht" 354 | built_in_name = "into" 355 | 356 | [_von_] 357 | word_type = "operator" 358 | name = "von" 359 | built_in_name = "from" 360 | 361 | [_wenn_] 362 | word_type = "choice" 363 | name = "Wenn" 364 | built_in_name = "if" 365 | 366 | [_Während_] 367 | word_type = "choice" 368 | name = "Während" 369 | built_in_name = "while" 370 | 371 | # Below is an example of how to add another Name to a Built In Verb 372 | # 'show' in English is approximately 'zeigen' in German 373 | [_zeigen_] 374 | word_type = "operator" 375 | name = "zeigen" 376 | built_in_name = "show" 377 | 378 | [_wiederholen_] 379 | word_type = "operator" 380 | name = "Wiederholen" 381 | built_in_name = "repeat" 382 |  -------------------------------------------------------------------------------- /Dictionaries/forGL_Test.toml: -------------------------------------------------------------------------------- 1 | # This is a forGL dictionary as a TOML document. (Prototype version of forGL) 2 | # 3 | # .toml is the required file extension to avoid some parse problems 4 | # 5 | # UTF8 character encoding is required 6 | # 7 | # User viewpoint: Definitions of forGL words in the dictionary act 8 | # like Nouns and Verbs (and other Natural Language or Math ideas) ... 9 | # forGL Library viewpoint: like Data and Code and Math operators, ... 10 | 11 | # Required: 12 | # Must be the first section of a dictionary 13 | [forGL_dictionary] 14 | 15 | # This is the number of times that this dictionary file has been saved with 1 or more changes. 16 | content_change_number = 0 17 | 18 | # Required: 19 | # Version of the way of representing a forGL dictionary. Semantic version 2 approach 20 | # If you want to track how many times content within a specific dictionary changes 21 | # see: forGL_dictionary.content_change_number above 22 | # 23 | [version] 24 | version = 0.0.1.Alpha 25 | 26 | # Optional: 27 | # Hint about Natural Language name. Must be English name of Language. 28 | [language] 29 | natural_language = English 30 | 31 | # Optional: 32 | # This is to allow new languages to be defined that are not part of already built in language support. 33 | # Maybe a language from a book or cinema (movie) or game? 34 | # 35 | # If you have a natural_language like German or Spanish 36 | # then these settings are ignored because the reading_order is already known. 37 | # 38 | # Also for Mathematics the reading_order is set as Left to Right and Top to Bottom 39 | # 40 | # Reading order: Left to Right and Top to Bottom OR Right to Left and Top to Bottom 41 | [reading_order] 42 | left_to_right = true 43 | top_to_bottom = true 44 | 45 | 46 | # Optional: 47 | [money] 48 | monetary_unit_symbol = "$" 49 | 50 | # Optional: 51 | [decimal] 52 | decimal_point = "." 53 | 54 | #Optional: 55 | [thousands] 56 | thousands_sep = "," 57 | 58 | 59 | # Information needed to define a word: 60 | # 61 | # Name (required and must be unique in spelling) 62 | # 63 | # The first character of any name must Not be a number digit (0 to 9). 64 | # Other number digits may also be invalid for languages that use them. 65 | # 66 | # A name must Not have: 67 | # any blank space or tab character 68 | # any \ (back slash) or newline (carriage Return or Line Feed) character 69 | # 70 | # A User defined name must Not contain: 71 | # reserved Mathematics, Logical, Grouping operators or Punctuation characters. 72 | # + - * / % < <= == = > >= ! ? != ( ) [ ] { } . , ; : ... 73 | # All of the above are invalid for User defined names 74 | # as they are already being used by forGL. 75 | # 76 | # If this is any User defined name you may have any combination of 77 | # other valid UTF8 characters that follow the above requirements. 78 | # 79 | # You are not limited to using only characters within a specific natural language. 80 | # 81 | # Type (required and must be: Noun or Verb or Operator or Choice) 82 | # 83 | # A Noun must have a value such as: 84 | # a quoted string "Hi there! " 85 | # a number such as: 3.5 or 11 or 1.7654e5 or 0xf001 86 | # a Bool which will may be either true or false 87 | # 88 | # Any Noun as a defined word in a dictionary must have a value. 89 | # 90 | # A Verb is a definition of some action(s) that are wanted. 91 | # Constants like a specific string, number or Bool value 92 | # are found in verb definitions. 93 | # 94 | # Verb(s) can also use what looks like a Noun that is not defined. 95 | # Undefined Nouns are used locally within the verb and 96 | # are not available in other verbs. These are called local nouns. 97 | # 98 | # Operator(s) are similar to verb(s) that are limited to one possible action. 99 | # Provided operator(s) use 0, 1 or 2 data items (Nouns or constants) 100 | # 101 | # There are some already defined words that help with some common tasks. 102 | # These are called Built In Verbs: 103 | # repeat 104 | # show 105 | # view 106 | # 107 | # Built In Name (Required only for Operators. Must be in English) 108 | # 109 | # value (Required for Nouns and Verbs) 110 | # 111 | # Nouns: value Examples 112 | # value = 5 (integer number) 113 | # value = 0x15 (integer as Hexadecimal = 21 here) 114 | # value = 5.7654e2 (scientific notation for floating point number = 576.54) 115 | # value = true (Boolean) 116 | # value = "Having a wonderful time. Wish you were here." (string) 117 | # value = "" (a string that has no text characters, an empty string) 118 | # value = """Having 119 | # a 120 | # wonderful 121 | # time.""" (multi-line string as 4 lines) 122 | # 123 | # Verbs: value Examples 124 | # MAY be multi-line strings of the definition. 125 | # Multi-line strings start and end with 3 double Quote characters. 126 | # 3 double Quote characters allow quoted strings inside a verb. 127 | # value = """"Hi there! " = y. y show.""" 128 | # value = """45 radians = x. sin(x)/cos(x) show""" 129 | # value = "" 130 | # 131 | # value = """blat equals 32. 132 | # blat times 0x12. 133 | # show 1000 REPEAT""" 134 | # 135 | # OR 136 | # Use only 1 double Quote character if there will be NO inside quoted strings. 137 | # value = "x = 45 radians. sin(x)/cos(x) show" 138 | # 139 | # Operators that use 2 Data items 140 | # 141 | 142 | # Arithmetic 143 | # 144 | # This must be unique in spelling. Wrong to have [_PLUS] and later [_plus] 145 | [_Plus] 146 | # Must be: noun, verb, operator, or choice 147 | word_type = "operator" 148 | 149 | # Must be unique in spelling. Change "plus" to support any language. 150 | name = "plus" 151 | 152 | # Do Not change this Built In Operator name 153 | built_in_name = "+" 154 | 155 | 156 | [_Minus] 157 | word_type = "operator" 158 | name = "minus" 159 | built_in_name = "-" 160 | 161 | 162 | [_Multiply] 163 | word_type = "operator" 164 | name = "multiply" 165 | built_in_name = "*" 166 | 167 | 168 | [_Divide] 169 | word_type = "operator" 170 | name = "divide" 171 | built_in_name = "/" 172 | 173 | 174 | [Modulo] 175 | word_type = "operator" 176 | name = "modulo" 177 | built_in_name = "%" 178 | 179 | [Decrement] 180 | word_type = "operator" 181 | name = "decrement" 182 | built_in_name = "--" 183 | 184 | [Increment] 185 | word_type = "operator" 186 | name = "increment" 187 | built_in_name = "++" 188 | 189 | # Comparison (these need 2 Data items, result is Bool: true or false) 190 | # 191 | [Is_Equal] 192 | word_type = "operator" 193 | name = "isEqual" 194 | built_in_name = "==" 195 | 196 | [Is_Not_Equal] 197 | word_type = "operator" 198 | name = "notEqual" 199 | built_in_name = "!=" 200 | 201 | [Is_Less_Than] 202 | word_type = "operator" 203 | name = "lessThan" 204 | built_in_name = "<" 205 | 206 | [Is_Less_Or_Equal] 207 | word_type = "operator" 208 | name = "lessOrEqual" 209 | built_in_name = "<=" 210 | 211 | [Is_Greater_Than] 212 | word_type = "operator" 213 | name = "greaterThan" 214 | built_in_name = ">" 215 | 216 | [Is_Greater_Or_Equal] 217 | word_type = "operator" 218 | name = "greaterOrEqual" 219 | built_in_name = ">=" 220 | 221 | # Choice 222 | # 223 | word_type = "choice" 224 | name = "If" 225 | built_in_name = "if" 226 | 227 | 228 | 229 | # Mathematics 230 | # 231 | 232 | # Uncomment this to see a message about a non Unique word 233 | #[Modulo] 234 | #word_type = "operator" 235 | #name = "modulo" 236 | #built_in_name = "%" 237 | 238 | [limit] 239 | word_type = "noun" 240 | name = "limit" 241 | value = 7 242 | 243 | [n1] 244 | word_type = "noun" 245 | name = "n1" 246 | value = 7 247 | 248 | [result] 249 | word_type = "noun" 250 | name = "result" 251 | value = 0 252 | 253 | [factorial] 254 | word_type = "verb" 255 | # Put a number on the Data stack (like 5) to find the factorial. 256 | name = "factorial" 257 | value = into L. 1. into p. 1 into i. while ( i <= L ){ p * i into p. i + 1 into i.} p. 258 | 259 | [Faktorial] 260 | word_type = "verb" 261 | # Legen Sie eine Nummer auf den Datenstapel (wie 5), um das Faktorial zu finden. 262 | name = "Faktorial" 263 | value = geht L. 1. geht p. 1 geht i. Während(i<=L){p*i geht p. i+1 geht i} p. 264 | 265 | [fib] 266 | word_type = "verb" 267 | # Put a number on the Data stack (like 7) if you want the 8th Fibonacci number. 268 | # This counts from 0 instead of 1 for the number you give. So 0 would give the 1st. 269 | name = "Fib" 270 | value = into L.if ( 0 == L ) { 0 return } 271 | if ( 2 <= L ) { 1 return } 272 | 1 into p. 273 | 2 into q. 274 | p + q into f. 275 | 3 into n. 276 | while ( n <= L ) 277 | { 278 | p + q into f. 279 | q into p. 280 | f into q. 281 | n + 1 into n. 282 | n show. 283 | } 284 | f 285 | if ( 0 == L ) { 0 return } 286 | if ( 2 <= L ) { 1 return } 287 | 1 into p. 288 | 2 into q. 289 | p + q into f. 290 | 3 into n. 291 | while ( n <= L ) 292 | { 293 | p + q into f. 294 | q into p. 295 | f into q. 296 | n + 1 into n. 297 | n show. 298 | } 299 | f 300 | 301 | [v1] 302 | word_type = "verb" 303 | name = "v1" 304 | value = 5 =: n1. n1 show 305 | 306 | [_from_] 307 | word_type = "operator" 308 | name = "from" 309 | built_in_name = ":=" 310 | 311 | [_into_] 312 | word_type = "operator" 313 | name = "into" 314 | built_in_name = "=:" 315 | 316 | [_TEST_FACTORIAL_] 317 | word_type = "verb" 318 | name = "TEST_FACTORIAL" 319 | value = into L. 1 into I. while(I<=L){I factorial. " " + show. I+1 into I} 320 | 321 | [_TEST_FIB_] 322 | word_type = "verb" 323 | name = "TEST_FIB" 324 | value = into L. 1 into I. while(I<=L){I Fib. " " + show. I+1 into I} 325 | 326 | [_glücklich_] 327 | word_type = "noun" 328 | name = "glücklich" 329 | value = "glücklich ist besser" 330 | 331 | [_feliz_] 332 | word_type = "noun" 333 | name = "feliz" 334 | value = "feliz es mejor" 335 | 336 | [_heureux_] 337 | word_type = "noun" 338 | name = "heureux" 339 | value = "heureux c'est mieux" 340 | 341 | [_felice_] 342 | word_type = "noun" 343 | name = "felice" 344 | value = "felice è meglio" 345 | 346 | [_happy_] 347 | word_type = "noun" 348 | name = "happy" 349 | value = "happy is better" 350 | 351 | [_geht_] 352 | word_type = "operator" 353 | name = "geht" 354 | built_in_name = "into" 355 | 356 | [_von_] 357 | word_type = "operator" 358 | name = "von" 359 | built_in_name = "from" 360 | 361 | [_wenn_] 362 | word_type = "choice" 363 | name = "Wenn" 364 | built_in_name = "if" 365 | 366 | [_Während_] 367 | word_type = "choice" 368 | name = "Während" 369 | built_in_name = "while" 370 | 371 | # Below is an example of how to add another Name to a Built In Verb 372 | # 'show' in English is approximately 'zeigen' in German 373 | [_zeigen_] 374 | word_type = "operator" 375 | name = "zeigen" 376 | built_in_name = "show" 377 | 378 | [_wiederholen_] 379 | word_type = "operator" 380 | name = "Wiederholen" 381 | built_in_name = "repeat" 382 |  -------------------------------------------------------------------------------- /Dictionaries/forGL_Dictionary_Prototype.toml: -------------------------------------------------------------------------------- 1 | # This is a forGL dictionary as a TOML document. (Prototype version of forGL) 2 | # 3 | # .toml is the required file extension to avoid some parse problems 4 | # 5 | # UTF8 character encoding is required 6 | # 7 | # User viewpoint: Definitions of forGL words in the dictionary act 8 | # like Nouns and Verbs (and other Natural Language or Math ideas) ... 9 | # forGL Library viewpoint: like Data and Code and Math operators, ... 10 | 11 | # Required: 12 | # Must be the first section of a dictionary 13 | [forGL_dictionary] 14 | 15 | # This is the number of times that this dictionary file has been saved with 1 or more changes. 16 | content_change_number = 0 17 | 18 | # Required: 19 | # Version of the way of representing a forGL dictionary. Semantic version 2 approach 20 | # If you want to track how many times content within a specific dictionary changes 21 | # see: forGL_dictionary.content_change_number above 22 | # 23 | [version] 24 | version = 0.0.1.Alpha 25 | 26 | # Optional: 27 | # Hint about Natural Language name. Must be English name of Language. 28 | [language] 29 | natural_language = English 30 | 31 | # Optional: 32 | # This is to allow new languages to be defined that are not part of already built in language support. 33 | # Maybe a language from a book or cinema (movie) or game? 34 | # 35 | # If you have a natural_language like German or Spanish 36 | # then these settings are ignored because the reading_order is already known. 37 | # 38 | # Also for Mathematics the reading_order is set as Left to Right and Top to Bottom 39 | # 40 | # Reading order: Left to Right and Top to Bottom OR Right to Left and Top to Bottom 41 | [reading_order] 42 | left_to_right = true 43 | top_to_bottom = true 44 | 45 | 46 | # Optional: 47 | [money] 48 | monetary_unit_symbol = "$" 49 | 50 | # Optional: 51 | [decimal] 52 | decimal_point = "." 53 | 54 | #Optional: 55 | [thousands] 56 | thousands_sep = "," 57 | 58 | 59 | # Information needed to define a word: 60 | # 61 | # Name (required and must be unique in spelling) 62 | # 63 | # The first character of any name must Not be a number digit (0 to 9). 64 | # Other number digits may also be invalid for languages that use them. 65 | # 66 | # A name must Not have: 67 | # any blank space or tab character 68 | # any \ (back slash) or newline (carriage Return or Line Feed) character 69 | # 70 | # A User defined name must Not contain: 71 | # reserved Mathematics, Logical, Grouping operators or Punctuation characters. 72 | # + - * / % < <= == = > >= ! ? != ( ) [ ] { } . , ; : ... 73 | # All of the above are invalid for User defined names 74 | # as they are already being used by forGL. 75 | # 76 | # If this is any User defined name you may have any combination of 77 | # other valid UTF8 characters that follow the above requirements. 78 | # 79 | # You are not limited to using only characters within a specific natural language. 80 | # 81 | # Type (required and must be: Noun or Verb or Operator or Choice) 82 | # 83 | # A Noun must have a value such as: 84 | # a quoted string "Hi there! " 85 | # a number such as: 3.5 or 11 or 1.7654e5 or 0xf001 86 | # a Bool which will may be either true or false 87 | # 88 | # Any Noun as a defined word in a dictionary must have a value. 89 | # 90 | # A Verb is a definition of some action(s) that are wanted. 91 | # Constants like a specific string, number or Bool value 92 | # are found in verb definitions. 93 | # 94 | # Verb(s) can also use what looks like a Noun that is not defined. 95 | # Undefined Nouns are used locally within the verb and 96 | # are not available in other verbs. These are called local nouns. 97 | # 98 | # Operator(s) are similar to verb(s) that are limited to one possible action. 99 | # Provided operator(s) use 0, 1 or 2 data items (Nouns or constants) 100 | # 101 | # There are some already defined words that help with some common tasks. 102 | # These are called Built In Verbs: 103 | # repeat 104 | # show 105 | # view 106 | # 107 | # Built In Name (Required only for Operators. Must be in English) 108 | # 109 | # value (Required for Nouns and Verbs) 110 | # 111 | # Nouns: value Examples 112 | # value = 5 (integer number) 113 | # value = 0x15 (integer as Hexadecimal = 21 here) 114 | # value = 5.7654e2 (scientific notation for floating point number = 576.54) 115 | # value = true (Boolean) 116 | # value = "Having a wonderful time. Wish you were here." (string) 117 | # value = "" (a string that has no text characters, an empty string) 118 | # value = """Having 119 | # a 120 | # wonderful 121 | # time.""" (multi-line string as 4 lines) 122 | # 123 | # Verbs: value Examples 124 | # MAY be multi-line strings of the definition. 125 | # Multi-line strings start and end with 3 double Quote characters. 126 | # 3 double Quote characters allow quoted strings inside a verb. 127 | # value = """"Hi there! " = y. y show.""" 128 | # value = """45 radians = x. sin(x)/cos(x) show""" 129 | # value = "" 130 | # 131 | # value = """blat equals 32. 132 | # blat times 0x12. 133 | # show 1000 REPEAT""" 134 | # 135 | # OR 136 | # Use only 1 double Quote character if there will be NO inside quoted strings. 137 | # value = "x = 45 radians. sin(x)/cos(x) show" 138 | # 139 | # Operators that use 2 Data items 140 | # 141 | 142 | # Arithmetic 143 | # 144 | # This must be unique in spelling. Wrong to have [_PLUS] and later [_plus] 145 | [_Plus] 146 | # Must be: noun, verb, operator, or choice 147 | word_type = "operator" 148 | 149 | # Must be unique in spelling. Change "plus" to support any language. 150 | name = "plus" 151 | 152 | # Do Not change this Built In Operator name 153 | built_in_name = "+" 154 | 155 | 156 | [_Minus] 157 | word_type = "operator" 158 | name = "minus" 159 | built_in_name = "-" 160 | 161 | 162 | [_Multiply] 163 | word_type = "operator" 164 | name = "multiply" 165 | built_in_name = "*" 166 | 167 | 168 | [_Divide] 169 | word_type = "operator" 170 | name = "divide" 171 | built_in_name = "/" 172 | 173 | 174 | [Modulo] 175 | word_type = "operator" 176 | name = "modulo" 177 | built_in_name = "%" 178 | 179 | [Decrement] 180 | word_type = "operator" 181 | name = "decrement" 182 | built_in_name = "--" 183 | 184 | [Increment] 185 | word_type = "operator" 186 | name = "increment" 187 | built_in_name = "++" 188 | 189 | # Comparison (these need 2 Data items, result is Bool: true or false) 190 | # 191 | [Is_Equal] 192 | word_type = "operator" 193 | name = "isEqual" 194 | built_in_name = "==" 195 | 196 | [Is_Not_Equal] 197 | word_type = "operator" 198 | name = "notEqual" 199 | built_in_name = "!=" 200 | 201 | [Is_Less_Than] 202 | word_type = "operator" 203 | name = "lessThan" 204 | built_in_name = "<" 205 | 206 | [Is_Less_Or_Equal] 207 | word_type = "operator" 208 | name = "lessOrEqual" 209 | built_in_name = "<=" 210 | 211 | [Is_Greater_Than] 212 | word_type = "operator" 213 | name = "greaterThan" 214 | built_in_name = ">" 215 | 216 | [Is_Greater_Or_Equal] 217 | word_type = "operator" 218 | name = "greaterOrEqual" 219 | built_in_name = ">=" 220 | 221 | # Choice 222 | # 223 | word_type = "choice" 224 | name = "If" 225 | built_in_name = "if" 226 | 227 | 228 | 229 | # Mathematics 230 | # 231 | 232 | # Uncomment this to see a message about a non Unique word 233 | #[Modulo] 234 | #word_type = "operator" 235 | #name = "modulo" 236 | #built_in_name = "%" 237 | 238 | [limit] 239 | word_type = "noun" 240 | name = "limit" 241 | value = 7 242 | 243 | [n1] 244 | word_type = "noun" 245 | name = "n1" 246 | value = 7 247 | 248 | [result] 249 | word_type = "noun" 250 | name = "result" 251 | value = 0 252 | 253 | [factorial] 254 | word_type = "verb" 255 | # Put a number on the Data stack (like 5) to find the factorial. 256 | name = "factorial" 257 | value = into L. 1. into p. 1 into i. while ( i <= L ){ p * i into p. i + 1 into i.} p. 258 | 259 | [Faktorial] 260 | word_type = "verb" 261 | # Legen Sie eine Nummer auf den Datenstapel (wie 5), um das Faktorial zu finden. 262 | name = "Faktorial" 263 | value = geht L. 1. geht p. 1 geht i. Während(i<=L){p*i geht p. i+1 geht i} p. 264 | 265 | [fib] 266 | word_type = "verb" 267 | # Put a number on the Data stack (like 7) if you want the 8th Fibonacci number. 268 | # This counts from 0 instead of 1 for the number you give. So 0 would give the 1st. 269 | name = "Fib" 270 | value = into L.if ( 0 == L ) { 0 return } 271 | if ( 2 <= L ) { 1 return } 272 | 1 into p. 273 | 2 into q. 274 | p + q into f. 275 | 3 into n. 276 | while ( n <= L ) 277 | { 278 | p + q into f. 279 | q into p. 280 | f into q. 281 | n + 1 into n. 282 | n show. 283 | } 284 | f 285 | if ( 0 == L ) { 0 return } 286 | if ( 2 <= L ) { 1 return } 287 | 1 into p. 288 | 2 into q. 289 | p + q into f. 290 | 3 into n. 291 | while ( n <= L ) 292 | { 293 | p + q into f. 294 | q into p. 295 | f into q. 296 | n + 1 into n. 297 | n show. 298 | } 299 | f 300 | 301 | [v1] 302 | word_type = "verb" 303 | name = "v1" 304 | value = 5 =: n1. n1 show 305 | 306 | [_from_] 307 | word_type = "operator" 308 | name = "from" 309 | built_in_name = ":=" 310 | 311 | [_into_] 312 | word_type = "operator" 313 | name = "into" 314 | built_in_name = "=:" 315 | 316 | [_TEST_FACTORIAL_] 317 | word_type = "verb" 318 | name = "TEST_FACTORIAL" 319 | value = into L. 1 into I. while(I<=L){I factorial. " " + show. I+1 into I} 320 | 321 | [_TEST_FIB_] 322 | word_type = "verb" 323 | name = "TEST_FIB" 324 | value = into L. 1 into I. while(I<=L){I Fib. " " + show. I+1 into I} 325 | 326 | [_glücklich_] 327 | word_type = "noun" 328 | name = "glücklich" 329 | value = "glücklich ist besser" 330 | 331 | [_feliz_] 332 | word_type = "noun" 333 | name = "feliz" 334 | value = "feliz es mejor" 335 | 336 | [_heureux_] 337 | word_type = "noun" 338 | name = "heureux" 339 | value = "heureux c'est mieux" 340 | 341 | [_felice_] 342 | word_type = "noun" 343 | name = "felice" 344 | value = "felice è meglio" 345 | 346 | [_happy_] 347 | word_type = "noun" 348 | name = "happy" 349 | value = "happy is better" 350 | 351 | [_geht_] 352 | word_type = "operator" 353 | name = "geht" 354 | built_in_name = "into" 355 | 356 | [_von_] 357 | word_type = "operator" 358 | name = "von" 359 | built_in_name = "from" 360 | 361 | [_wenn_] 362 | word_type = "choice" 363 | name = "Wenn" 364 | built_in_name = "if" 365 | 366 | [_Während_] 367 | word_type = "choice" 368 | name = "Während" 369 | built_in_name = "while" 370 | 371 | # Below is an example of how to add another Name to a Built In Verb 372 | # 'show' in English is approximately 'zeigen' in German 373 | [_zeigen_] 374 | word_type = "operator" 375 | name = "zeigen" 376 | built_in_name = "show" 377 | 378 | [_wiederholen_] 379 | word_type = "operator" 380 | name = "Wiederholen" 381 | built_in_name = "repeat" 382 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # forGL is a 4GL general purpose programming language. 2 | 3 | # NEW Version 0.0.3 built as forGL.py Nov 16, 2024 4 | 5 | # forGL Web Site (expect more changes here): 6 | https://www.forgl.org 7 | # . 8 | # Getting Started : Please see Applications folder & 9 | # _forGL_Getting_Started_READ_ME_NOW.txt above 10 | # *forGL will run on platforms with Python 3 or Java installed* 11 | # . 12 | # *for Testers the Browser folder has files to Debug with.* 13 | # *testing the Browser build (.js files) is not recommended because* 14 | # *when new interface to HaxeUI is working there will be a new HTML5 (+js stuff) build* 15 | updated January 7, 2022 16 | # . 17 | # N E W S : 18 | 19 | # . 20 | # January 7, 2022 (my New Year's Resolution, see 12) 21 | https://cult.honeypot.io/reads/developer-new-years-resolutions-for-2022/ 22 | # . 23 | # July 12, 2020 (first public post not on a Haxe related site) 24 | # forGL : Explore Language As Programming Code 25 | https://www.thinkspot.com/feed/single_post?psid=Vnu456 26 | # . 27 | # **forGL presented 2019 on May 9 and on May 10** 28 | # **at the Haxe US Summit 2019 in Seattle.** 29 | ## **May 9 ~ 11:30 ~ 12:30 forGL Introduction (1 hour)** 30 | https://www.youtube.com/watch?v=vgcHKTxVPMY&list=PLU2M-shPcj1zZYoaApqDtbl64f1rIJnp5&index=9 31 | 32 | ## **May 10 15:00 ~ 15:22 forGL Demo & Summary with some Haxe Summary: Computer Programming with your language (22 min)** 33 | https://www.youtube.com/watch?v=zlWQe9VXhBk 34 | 35 | 36 | ## **LINKS to Haxe US Summit 2019 Videos** 37 | https://community.haxe.org/t/haxe-us-summit-2019-video-links-all-3-days/1727 38 | 39 | See Haxe.org for more details about US Summit 2019. 40 | 41 | 42 | 43 | ## **S U M M A R Y** 44 | 45 | **forGL Java and Python text style applications are available.** 46 | 47 | **Haxe and other source files are available.** 48 | 49 | **READ_ME.txt** file is in each directory to help you. 50 | 51 | 52 | 53 | ## **forGL . . . L A N G U A G E . . D E S I G N . . I D E A S** 54 | 55 | **forGL is what I call now an application that sometimes acts like a programming language.** 56 | **More details of forGL as an application are found below and by running the app and in the Docs directory.** 57 | 58 | **Here is a very brief description of some of the programming language ideas in forGL.** 59 | **A very flexible Parser/Interpreter was needed to support the variety of 100+ natural languages of Earth.** 60 | **Support for display of languages other than English is found in various word definitions in provided dictionary .toml files.** 61 | 62 | # **Parser** 63 | **identifies single Tokens. forGL Dictionary holds the list of known definitions for each "Word".** 64 | **forGL Word use is very similar to a Word in a Forth programming language dictionary (math operators and punctuation are also considered to be words).** 65 | **Forth language contributed 2 key Ideas to forGL:** 66 | **1) the use of a Dictionary of word Definitions** 67 | **2) Words in the Dictionary are used to express a given Problem to be solved by a Program in words that closely represent the important concepts of the Problem.** 68 | 69 | **The "parts of speech" (upper level "types") of the forGL language are: Nouns, Verbs, Punctuation ( . , : ; ) and Operators (from Mathematics + - * / ^ and some others). Before the Interpreter starts each Token is searched for in the forGL Dictionary and any Tokens found are marked with the defined forGL type.** 70 | 71 | **If a Token is not in the Dictionary then it is checked to see if it is: an Integer OR a Number with Decial digits that sometimes will have a decimal point OR a Number in Scientific Notation OR a Hexadecimal number OR a literal String (these are the common low level types that most computer Hardware directly supports: Integer of the CPU word size 8, 16, 32, 64 bits Signed or Unsigned, Double or Float size for example).** 72 | 73 | **If a Token is still not identified it may be what is called a local Noun (a local Variable) within a Verb definition and treated as such. Local Nouns just exist as passive Tokens until referenced by the forGL Interpreter. Nouns are like variables in other programming languages which also mostly imitate the idea of a Variable from Algebra mathematics.** 74 | 75 | # **Interpreter** 76 | **implements a lot of the forGL language syntax flexibility.** 77 | **Interpreter directly supports Prefix, Infix and Postfix notation in almost any combination.** 78 | **The only combinations of flexible syntax not support are those where forGL is following an existing notation convention.** 79 | **Examples of fixed notation: (to be added later)** 80 | 81 | # **forGL Flexible Syntax Examples** 82 | **Prefix, Infix and Postfix syntax of Addition that will show 7 as the sum. Haxe Math operators are all supported.** 83 | 84 | **+ 5 2 show (prefix)** 85 | 86 | **Prefix notation is popular in programming languages like Lisp and Functual Programming languages.** 87 | **Prefix notation syntax is perhaps more commonly found as ( + 5 2 ) where enclosing parenthesis are required.** 88 | 89 | **5 + 2 show (infix)** 90 | 91 | **Infix notation is common in many programming languages (as well as Mathematics).** 92 | **Haxe and all the programming languages that Haxe targets as output use Infix.** 93 | 94 | **5 2 + show (postfix)** 95 | 96 | **Postfix notation is frequently used in Concatenative programming languages such as Forth.** 97 | **Forth language uses Postfix notation for efficiency reasons (less CPU operations needed and less memory needed).** 98 | 99 | **Assignment Support for Natural Language Use** 100 | 101 | **from & into are used as follows. Both will set x as Integer 42 (result of Multiplication).** 102 | 103 | **x from 6 * 7** 104 | 105 | **6 * 7 into x** 106 | 107 | **from keyword ( also := ) is exactly like Assignment operator '=' found in most programming languages.** 108 | 109 | **into keyword ( also =: ) is added to support expressions that are closer to Natural languages.** 110 | 111 | ## **forGL . . . F E A T U R E S** 112 | 113 | **Want to learn computer programming? forGL can help you.** 114 | 115 | **Prior experience with computer programming or even knowing English is not needed. If you can use a Dictionary you are ready to program. Knowing how to use a Calculator may help but is not required.** 116 | 117 | forGL is built now as a text mode cross platform application (also called a command line application). 118 | Later this year forGL will have a graphical interface. 119 | 120 | Because forGL allows you to do computer programming, forGL also provides features that computer programmers expect. 121 | **Colored text to clearly show different types of dictionary words:** 122 | **Verbs 123 | Nouns 124 | Operators 125 | Punctuation** 126 | 127 | **There are also some special types of words that are provided by forGL to make programming easier.** 128 | **Choice** words (the program may choose to change the next statement based on a true or false comparison). 129 | **if, else, while** ... 130 | 131 | Other choice words are reserved but not yet working. 132 | 133 | Another special type is called **Built In Verbs**. 134 | These are Verbs that are always part of a forGL dictionary when it is built in memory. 135 | **show, view** ... 136 | 137 | **forGL can run your code at full speed 138 | or automatically but with a delay you want between steps 139 | or manually under your control** 140 | 141 | **forGL will give you Warnings or Errors and try to provide useful information about why.** 142 | 143 | ## **forGL . . . O P T I O N S** 144 | 145 | ![forGL_Options_image](https://user-images.githubusercontent.com/12145438/57154617-31cfdb00-6d8e-11e9-801d-f0bc3ca0b0e3.png) 146 | 147 | Note: the screen capture above has settings you likely will want after you have good working forGL code. 148 | 149 | ### **Export test Verb to other programming languages (y/n) ? y** 150 | forGL allows you to save your working forGL code as source code of other programming languages. 151 | Below is a simple example: 152 | **x = sin ( pi / 4 ). "Sine of Pi / 4 = " + x show** 153 | 154 | **This calculates the Sine of 45 degrees and then prints a message with the calculated value. 155 | Export as Code does some rearrangement before the forGL interpreter runs to this:** 156 | 157 | **x := sin ( pi / 4 ) ; "Sine of Pi / 4 = " + x show** 158 | 159 | **We see that the equal sign = was changed to := giving the side of what is changed. 160 | x is on the left and so the := indicates the left side.** 161 | 162 | ![forGL_Export_As_Code_image](https://user-images.githubusercontent.com/12145438/57165213-4c647d00-6dab-11e9-9c89-e76d8c39e129.png) 163 | 164 | **We can see that there is enough information captured in the Export as Code Log output to allow experienced programmers to manually convert to most other programming languages. There will be more work on Export as Code to change as much as possible to a form used by many other programming languages.** 165 | 166 | **When Export as Code is fully working it will automatically generate source file(s) as wanted. The first programming language to save as will be Haxe because Haxe will then allow you to generate source code in about a dozen other programming languages.** 167 | 168 | The Export As Code feature is under active development and (hopefully) will be fully working soon. 169 | 170 | ### **Show details of various information (y/n) ? y** 171 | This option gives details of small steps of various calculations or changes to Nouns as the forGL interpreter runs. 172 | These details may help you to find a problem with your forGL code. 173 | 174 | ### **Show details of Words used (y/n) ? y** 175 | This option will show details of a Verb when it is ready to run by the forGL interpreter. 176 | 177 | ### **Show Stacks: *N* = none & no Steps OR *D* is only Data OR any Key for all ? a** 178 | forGL interpreter uses 3 stacks internally (and some other stacks and structures as well, see the Run.hx code). 179 | Data, Operators (Ops) and Nouns stacks show current values of each while you Manually step or forGL Automatically steps through your code. 180 | 181 | ![forGL_Stacks_image](https://user-images.githubusercontent.com/12145438/57164751-ef1bfc00-6da9-11e9-83f6-069cc3885f03.png) 182 | 183 | **Above we see that after forGL ran there was a Noun named x with a value of 0.707106781186547** 184 | 185 | **Select *D* for Data stack only if you do not want to see the small steps forGL uses to run your code.** 186 | 187 | If you select *N* then no stacks will show and forGL will be somewhat faster than using 0 delay time. 188 | 189 | ### **Manual stepping and all stacks will show.** 190 | This lets you know that you will see the 3 stacks and Manual stepping is available. 191 | 192 | ### **Stepping Speed: *0 to 9* (each as .2 sec delay) OR any Key for Manual ? 2** 193 | You may use a number to set a delay between steps or any other key to manually step through your code. 194 | 195 | If you use 0 meaning no delay, forGL has code that updates the 3 stacks or the Data stack (as you selected) 5 times a second. 196 | 197 | ### **Automatic stepping with 0.4 seconds delay.** 198 | This lets you know that the delay between steps you wanted will be done. 199 | 200 | ### **Show Dictionary (y/n) ? n** 201 | This will show the full contents of the in memory dictionary. When forGL starts it builds the in memory dictionary and then adds words that are valid that are from the .toml dictionary file. 202 | 203 | Later when forGL is stopping, the in memory dictionary is saved back to the dictionary file if there were any changes to Nouns in the dictionary or if any new Verbs were saved. 204 | 205 | ### **Test_Verb is:** 206 | ### **5 show. show( 7 )** 207 | ### **Type *test_verb* OR your Verb and hit Enter or only Enter to stop.** 208 | ### **testverb** 209 | 210 | **When forGL starts the text of a test to try is provided. 211 | The lines above shows the simple test and allows you to use it by typing in "testverb".** 212 | 213 | **The screen capture example of Export as Code above used: 214 | x = sin ( pi / 4 ). "Sine of Pi / 4 = " + x show** 215 | 216 | **When you enter a Verb to test forGL will allow you to Save the Verb definition before exiting.** 217 | 218 | ### **forGL uses ideas from :** 219 | 220 | ### **Natural Language :** 221 | 222 | **Ideas of Verbs, Nouns and Punctuation.** Use of a Dictionary of words to support programming in a single or a mix of Natural Languages. You may use words from multiple languages within a single Verb definition. 223 | 224 | ### **Mathematics as a Language :** 225 | 226 | **Ideas of various operations and functions such as : add, subtract, sin, cos ...** 227 | 228 | ### **Programming Language(s) :** 229 | 230 | **Reserved key words or symbols such as : =, !=, if, then, while ...** 231 | 232 | **Declarative key words such as: from, into, show, repeat ...** 233 | 234 | 235 | ### **W A R N I N G !** 236 | 237 | **The forGL application is a rough prototype with features that are incomplete, have significant defects (bugs) or even missing entirely.** 238 | 239 | **Most of the forGL application is written in Haxe with output to: C++, C#, Java, Python and JavaScript.** 240 | 241 | ### **Test platforms used :** 242 | 243 | Laptops running Windows 7 and 10. 244 | 245 | **Languages used to implement forGL tested: C++, Java, Python, (all working OK)** 246 | 247 | **C# (no color or cursor positioning),** 248 | 249 | JavaScript (not really working). 250 | 251 | Very incomplete testing on old Android phone with incomplete JavaScript / HTML / JavaScript Web Worker (from Haxe). 252 | 253 | ## Links to forGL 254 | **Official web site** 255 | https://www.forgl.org 256 | 257 | **Haxe Community** forum (Very helpful members) 258 | Several references, search for: **4GL** or **forGL** 259 | 260 | https://community.haxe.org/t/forgl-information-in-github/1606/9 261 | 262 | 263 | **Haxe.io** site ... Information about lots of programs using Haxe 264 | 265 | https://haxe.io/roundups/478/ 266 | 267 | 268 | ### **If you like forGL please consider donating to the Haxe Foundation.** 269 | 270 | **https://opencollective.com/haxe/donate?referral=30077** 271 | 272 | 273 | 274 | **... forGL awaits ...** 275 | -------------------------------------------------------------------------------- /src/forGL/Meanings.hx: -------------------------------------------------------------------------------- 1 | /* Meanings.hx Meanings of Operators and Return values 2 | * 3 | * Prototype (VERY Experimental) of forGL application 4 | * 5 | * ... 6 | * @author Randy Maxwell 7 | */ 8 | 9 | package forGL; 10 | 11 | 12 | // Improved UTF8 support 13 | using hx.strings.Strings; 14 | using hx.strings.String8; 15 | 16 | // Have Comments in Haxe generated output programming languages sources 17 | import forGL.Comments.comment as comment; 18 | 19 | // List of Operator Meanings 20 | // 21 | // Some notes here for FUTURE improvements 22 | // 23 | // Overall GOAL is to do as much compatibility with Haxe supported features 24 | // and also provide other language Features as well. 25 | // 26 | // References: 27 | // Haxe operators and differences from C based languages (C++, Java, PHP, JavaScript, ...) 28 | // https://haxe.org/manual/expression-operators-precedence.html 29 | // 30 | // short discussion of various C++ operators with simple examples 31 | // https://www.cplusplus.com/doc/tutorial/operators/ 32 | // 33 | // It is OK if there are gaps in the integer values used. 34 | // However, somewhat (very slightly?) better performance may be found if below has NO gaps. 35 | // Needs comparison timing tests. 36 | enum 37 | abstract OpMeanings(Int) { 38 | 39 | var OP_IS_UNKNOWN = 0; 40 | 41 | // Arithmetic (these need 2 Data items) 42 | var OP_IS_PLUS = 1; 43 | var OP_IS_MINUS = 2; 44 | var OP_IS_MULTIPLY = 3; 45 | var OP_IS_DIVIDE = 4; 46 | var OP_IS_MODULO = 5; 47 | 48 | // Math (these need 2 Data items) 49 | var OP_IS_MIN = 6; 50 | var OP_IS_MAX = 7; 51 | var OP_IS_ATAN2 = 8; 52 | var OP_IS_POW = 9; 53 | 54 | // Comparison (these need 2 Data items) 55 | // ( ==, !=, <, <=, >, >= ) 56 | var OP_IS_EQUAL = 10; 57 | var OP_IS_NOT_EQUAL = 11; 58 | var OP_IS_LESS_THAN = 12; 59 | var OP_IS_LESS_OR_EQUAL = 13; 60 | var OP_IS_GREATER_THAN = 14; 61 | var OP_IS_GREATER_OR_EQUAL = 15; 62 | 63 | 64 | // Possible Future improvement. As of now use an if keyword instead. 65 | // 66 | // Conditional ternary operator ( ? ) 67 | // a>b ? a : b 68 | // 69 | 70 | // 71 | // FUTURE improvement Logical operators 72 | // ( !, &&, || ) 73 | // example from C++ but most languages have these 74 | // 75 | 76 | // Grouping (grouping must have both a Left and Right side Operator) 77 | var OP_IS_PAREN_LEFT = 16; // Parens ( ) enclose an Expression OR as a call type argument list 78 | var OP_IS_PAREN_RIGHT = 17; 79 | var OP_IS_EXPRESSION_START = 18; 80 | var OP_IS_EXPRESSION_END = 19; 81 | var OP_IS_BRACKET_LEFT = 20; // Brackets [ ] enclose a list of values or Array [ elements ] 82 | var OP_IS_BRACKET_RIGHT = 21; 83 | var OP_IS_LIST_START = 22; 84 | var OP_IS_LIST_END = 23; 85 | var OP_IS_BRACE_LEFT = 24; // Braces { } enclose a block of statements 86 | var OP_IS_BRACE_RIGHT = 25; 87 | var OP_IS_BLOCK_START = 26; 88 | var OP_IS_BLOCK_END = 27; 89 | 90 | // Require use of string (must be 2 strings) 91 | var OP_IS_CONCAT = 28; 92 | var OP_IS_UNCONCAT = 29; 93 | 94 | // Math (these need NO Data items) 95 | var OP_IS_PI = 30; 96 | var OP_IS_RANDOM = 31; 97 | 98 | // Noun change 99 | // (requires a local or global Noun AND other value from Data stack or expression) 100 | var OP_IS_ASSIGNMENT = 32; // direction of Assignment determined later = 101 | var OP_IS_ASSIGN_TO = 33; // direction of Assignment TO the RIGHT =: : represents the Destination side 102 | var OP_IS_ASSIGN_FROM = 34; // direction of Assignment FROM the RIGHT := this is the assignment of most programming languages 103 | var OP_IS_DECREMENT = 35; // Noun or Local Noun is Integer or Float OR String can be made Integer or Float subtract 1 and assign 104 | var OP_IS_INCREMENT = 36; // as for decrement but add 1 and assign 105 | 106 | // 107 | // FUTURE improvement Compound assignment 108 | // (+=, -=, *=, /=, %=, >>=, <<=, &=, ^=, |=) 109 | // example from C++ but most languages have these 110 | // 111 | 112 | 113 | // Punctuation 114 | var OP_IS_PERIOD = 45; 115 | var OP_IS_COMMA = 46; 116 | var OP_IS_COLON = 47; 117 | var OP_IS_SEMICOLON = 48; 118 | 119 | var OP_IS_PUNCTUATION = 49; 120 | 121 | // Math Functions (these need 1 Data item) 122 | // abs, sin, cos, tan, asin, acos, atan, atan2, 123 | // log, sqrt, round, ceil, floor 124 | var OP_IS_ABS = 50; 125 | var OP_IS_TO_DEGREES = 51; 126 | var OP_IS_TO_RADIANS = 52; 127 | var OP_IS_SIN = 53; 128 | var OP_IS_COS = 54; 129 | var OP_IS_TAN = 55; 130 | var OP_IS_ASIN = 56; 131 | var OP_IS_ACOS = 57; 132 | var OP_IS_ATAN = 58; 133 | var OP_IS_EXP = 59; 134 | var OP_IS_LN = 60; // natural base e Logarithim == ln 135 | var OP_IS_LOG = 61; // base 10 Logarithim == log 136 | var OP_IS_SQRT = 62; 137 | var OP_IS_ROUND = 63; 138 | var OP_IS_FLOOR = 64; 139 | var OP_IS_CEIL = 65; // IF ANY HIGHER VALUES ARE ADDED UPDATE OpMeaningsValLimits BELOW ! ! ! 140 | 141 | // 142 | // Precedence of operators 143 | // 144 | // GOAL is to try to follow most languages approach (C++ as example with ALL of the complexity) 145 | // 146 | // Implemented elsewhere in other modules. MAY have a flag to control / override behavior in some cases. 147 | // 148 | } 149 | 150 | 151 | enum 152 | abstract OpMeaningsValLimits(Int) { 153 | var OP_IS_LOWEST_VAL = 0; // = cast( OP_IS_UNKNOWN, Int ); Inline variable initialization must be a constant value 154 | 155 | var OP_IS_HIGHEST_VAL = 65; // = cast( OP_IS_CEIL, Int ); 156 | } 157 | 158 | // List of Return value Meanings 159 | // 160 | // Negative numbers are used for Error or Stop Meanings 161 | // where Error recovery is unwanted or unlikely by runtime program. 162 | // User needs to change something 163 | // OR 164 | // There is a Defect in the code running that was hit 165 | // and reported an INTERNAL ERROR 166 | // 167 | // Zero means OK, normal results as expected. 168 | // 169 | // Positive means that some Verb or Operator or something 170 | // can not go farther now but other words can be run 171 | // 172 | enum 173 | abstract ReturnMeanings(Int) { 174 | 175 | // ERRORS about runtime code Defects 176 | var RET_IS_INTERNAL_ERROR = -11; // INTERNAL ERROR found 177 | var RET_IS_NOT_IMPLEMENTED = -10; // INTERNAL ERROR NOT IMPLEMENTED 178 | 179 | // ERRORS using runtime services 180 | var RET_FILE_NOT_FOUND = -9; 181 | var RET_FILE_PATH_NOT_FOUND = -8; 182 | 183 | // ERRORS about User code 184 | var RET_IS_USER_ERROR_LOGICAL = -5; // Ex: Extra Operators 185 | var RET_IS_USER_ERROR_SYNTAX = -4; // Ex: Using a Local Noun without giving it a value 186 | var RET_IS_USER_ERROR_DATA = -3; // Data missing or type not correct. Ex: String won't convert to Number. 187 | var RET_IS_USER_ERROR = -2; // Non specific 188 | 189 | // STOP 190 | var RET_IS_USER_ESC = -1; // User stopped runtime by choice 191 | 192 | // OK 193 | var RET_IS_OK = 0; // OK, normal results as expected 194 | 195 | // STATUS giving a little detail 196 | var RET_IS_NEEDS_DATA = 1; // not enough Data now, will try other words 197 | var RET_IS_NEEDS_NOUN = 2; // not enough Nouns now, will try other words 198 | var RET_IS_NEEDS_PUNCTUATION = 3; // no Punctuation yet, will try other words 199 | } 200 | 201 | 202 | class MeansWhat 203 | { 204 | // Helper to give a readable string for an Operator or an internal string 205 | // 206 | public static function opMeanAsStr( op_meaning : OpMeanings, ?ret_internal : Bool = false ) : String8 207 | { 208 | comment( "Helper to give a readable string for an Operator or an internal string" ); 209 | var ret_str = ""; 210 | 211 | switch ( op_meaning ) 212 | { 213 | case OP_IS_UNKNOWN: 214 | if ( ret_internal ) 215 | ret_str = ""; 216 | else 217 | ret_str = "Unknown"; 218 | 219 | // Math operators using 2 Data items 220 | case OP_IS_PLUS: 221 | if ( ret_internal ) 222 | ret_str = "+"; 223 | else 224 | ret_str = "Plus"; 225 | 226 | case OP_IS_MINUS: 227 | if ( ret_internal ) 228 | ret_str = "-"; 229 | else 230 | ret_str = "Minus"; 231 | 232 | case OP_IS_MULTIPLY: 233 | if ( ret_internal ) 234 | ret_str = "*"; 235 | else 236 | ret_str = "Multiply by"; 237 | 238 | case OP_IS_DIVIDE: 239 | if ( ret_internal ) 240 | ret_str = "/"; 241 | else 242 | ret_str = "Divide by"; 243 | 244 | case OP_IS_MODULO: 245 | if ( ret_internal ) 246 | ret_str = "%"; 247 | else 248 | ret_str = "Modulo"; 249 | 250 | case OP_IS_MIN: 251 | if ( ret_internal ) 252 | ret_str = "min"; 253 | else 254 | ret_str = "Minimum"; 255 | 256 | case OP_IS_MAX: 257 | if ( ret_internal ) 258 | ret_str = "max"; 259 | else 260 | ret_str = "Maximum"; 261 | 262 | case OP_IS_ATAN2: 263 | if ( ret_internal ) 264 | ret_str = "atan2"; 265 | else 266 | ret_str = "ArcTan2"; 267 | 268 | case OP_IS_POW: 269 | if ( ret_internal ) 270 | ret_str = "pow"; 271 | else 272 | ret_str = "to Power of"; 273 | 274 | // Comparison returning a Bool. These need 2 Data items 275 | case OP_IS_EQUAL: 276 | if ( ret_internal ) 277 | ret_str = "=="; 278 | else 279 | ret_str = "Is Equal?"; 280 | 281 | case OP_IS_NOT_EQUAL: 282 | if ( ret_internal ) 283 | ret_str = "!="; 284 | else 285 | ret_str = "Is Not Equal?"; 286 | 287 | case OP_IS_LESS_THAN: 288 | if ( ret_internal ) 289 | ret_str = "<"; 290 | else 291 | ret_str = "Is Less Than?"; 292 | 293 | case OP_IS_LESS_OR_EQUAL: 294 | if ( ret_internal ) 295 | ret_str = "<="; 296 | else 297 | ret_str = "Is Less or Equal?"; 298 | 299 | case OP_IS_GREATER_THAN: 300 | if ( ret_internal ) 301 | ret_str = ">"; 302 | else 303 | ret_str = "Is Greater Than?"; 304 | 305 | case OP_IS_GREATER_OR_EQUAL: 306 | if ( ret_internal ) 307 | ret_str = ">="; 308 | else 309 | ret_str = "Is Greater or Equal?"; 310 | 311 | // Grouping 312 | case OP_IS_PAREN_LEFT: 313 | if ( ret_internal ) 314 | ret_str = "("; 315 | else 316 | ret_str = "Left Paren"; 317 | 318 | case OP_IS_PAREN_RIGHT: 319 | if ( ret_internal ) 320 | ret_str = ")"; 321 | else 322 | ret_str = "Right Paren"; 323 | 324 | case OP_IS_EXPRESSION_START: 325 | if ( ret_internal ) 326 | ret_str = "("; 327 | else 328 | ret_str = "Expression start"; 329 | 330 | case OP_IS_EXPRESSION_END: 331 | if ( ret_internal ) 332 | ret_str = ")"; 333 | else 334 | ret_str = "Expression end"; 335 | 336 | case OP_IS_BRACKET_LEFT: 337 | if ( ret_internal ) 338 | ret_str = "["; 339 | else 340 | ret_str = "Left Square Bracket"; 341 | 342 | case OP_IS_BRACKET_RIGHT: 343 | if ( ret_internal ) 344 | ret_str = "]"; 345 | else 346 | ret_str = "Right Square Bracket"; 347 | 348 | case OP_IS_LIST_START: 349 | if ( ret_internal ) 350 | ret_str = "("; 351 | else 352 | ret_str = "List start"; 353 | 354 | case OP_IS_LIST_END: 355 | if ( ret_internal ) 356 | ret_str = ")"; 357 | else 358 | ret_str = "List end"; 359 | 360 | case OP_IS_BRACE_LEFT: 361 | if ( ret_internal ) 362 | ret_str = "{"; 363 | else 364 | ret_str = "Left Curly Brace"; 365 | 366 | case OP_IS_BRACE_RIGHT: 367 | if ( ret_internal ) 368 | ret_str = "}"; 369 | else 370 | ret_str = "Right Curly Brace"; 371 | 372 | case OP_IS_BLOCK_START: 373 | if ( ret_internal ) 374 | ret_str = "{"; 375 | else 376 | ret_str = "Block start"; 377 | 378 | case OP_IS_BLOCK_END: 379 | if ( ret_internal ) 380 | ret_str = "}"; 381 | else 382 | ret_str = "BLock end"; 383 | 384 | // Require use of string (must be 2 strings) 385 | case OP_IS_CONCAT: 386 | if ( ret_internal ) 387 | ret_str = "concat"; 388 | else 389 | ret_str = "Concatenate"; 390 | 391 | case OP_IS_UNCONCAT: 392 | if ( ret_internal ) 393 | ret_str = "unconcat"; 394 | else 395 | ret_str = "Un Concatenate"; 396 | 397 | // Math Operators that need NO data 398 | case OP_IS_PI: 399 | if ( ret_internal ) 400 | ret_str = "pi"; 401 | else 402 | ret_str = "Pi"; 403 | 404 | case OP_IS_RANDOM: 405 | if ( ret_internal ) 406 | ret_str = "random"; 407 | else 408 | ret_str = "Random"; 409 | 410 | 411 | // Noun change 412 | case OP_IS_ASSIGNMENT: 413 | if ( ret_internal ) 414 | ret_str = "="; 415 | else 416 | ret_str = "Assignment"; 417 | 418 | case OP_IS_ASSIGN_TO: 419 | if ( ret_internal ) 420 | ret_str = "=:"; 421 | else 422 | ret_str = "Assign into"; 423 | 424 | case OP_IS_ASSIGN_FROM: 425 | if ( ret_internal ) 426 | ret_str = ":="; 427 | else 428 | ret_str = "Assign from"; 429 | 430 | case OP_IS_DECREMENT: 431 | if ( ret_internal ) 432 | ret_str = "--"; 433 | else 434 | ret_str = "Decrease by 1"; 435 | 436 | case OP_IS_INCREMENT: 437 | if ( ret_internal ) 438 | ret_str = "++"; 439 | else 440 | ret_str = "Increase by 1"; 441 | 442 | // Punctuation 443 | case OP_IS_PERIOD: 444 | if ( ret_internal ) 445 | ret_str = "."; 446 | else 447 | ret_str = "Period"; 448 | 449 | case OP_IS_COMMA: 450 | if ( ret_internal ) 451 | ret_str = ","; 452 | else 453 | ret_str = "Comma"; 454 | 455 | case OP_IS_COLON: 456 | if ( ret_internal ) 457 | ret_str = ":"; 458 | else 459 | ret_str = "Colon"; 460 | 461 | case OP_IS_SEMICOLON: 462 | if ( ret_internal ) 463 | ret_str = ";"; 464 | else 465 | ret_str = "Semicolon"; 466 | 467 | case OP_IS_PUNCTUATION: 468 | if ( ret_internal ) 469 | ret_str = "."; 470 | else 471 | ret_str = "Punctuation"; 472 | 473 | // Math operators using 1 Data item 474 | case OP_IS_ABS: 475 | if ( ret_internal ) 476 | ret_str = "abs"; 477 | else 478 | ret_str = "Absolute value"; 479 | 480 | case OP_IS_TO_DEGREES: 481 | if ( ret_internal ) 482 | ret_str = "degrees"; 483 | else 484 | ret_str = "to Degrees"; 485 | 486 | case OP_IS_TO_RADIANS: 487 | if ( ret_internal ) 488 | ret_str = "radians"; 489 | else 490 | ret_str = "to Radians"; 491 | 492 | case OP_IS_SIN: 493 | if ( ret_internal ) 494 | ret_str = "sin"; 495 | else 496 | ret_str = "Sine"; 497 | 498 | case OP_IS_COS: 499 | if ( ret_internal ) 500 | ret_str = "cos"; 501 | else 502 | ret_str = "Cosine"; 503 | 504 | case OP_IS_TAN: 505 | if ( ret_internal ) 506 | ret_str = "tan"; 507 | else 508 | ret_str = "Tangent"; 509 | 510 | case OP_IS_ASIN: 511 | if ( ret_internal ) 512 | ret_str = "asin"; 513 | else 514 | ret_str = "ArcSine"; 515 | 516 | case OP_IS_ACOS: 517 | if ( ret_internal ) 518 | ret_str = "acos"; 519 | else 520 | ret_str = "ArcCosine"; 521 | 522 | case OP_IS_ATAN: 523 | if ( ret_internal ) 524 | ret_str = "atan"; 525 | else 526 | ret_str = "ArcTangent"; 527 | 528 | // Comment from Haxe Math.hx 529 | // ln( exp(v) ) is always == v 530 | // exp( ln(v) ) is always == v also true 531 | 532 | case OP_IS_EXP: 533 | if ( ret_internal ) 534 | ret_str = "exp"; 535 | else 536 | ret_str = "e to the power of"; 537 | 538 | case OP_IS_LN: 539 | if ( ret_internal ) 540 | ret_str = "ln"; 541 | else 542 | ret_str = "natural Logarithm"; // ln NOT log base 10 543 | 544 | case OP_IS_LOG: 545 | if ( ret_internal ) 546 | ret_str = "log"; 547 | else 548 | ret_str = "base 10 Logarithm"; // log base 10 549 | 550 | case OP_IS_SQRT: 551 | if ( ret_internal ) 552 | ret_str = "sqrt"; 553 | else 554 | ret_str = "SquareRoot"; 555 | 556 | case OP_IS_ROUND: 557 | if ( ret_internal ) 558 | ret_str = "round"; 559 | else 560 | ret_str = "Round"; 561 | 562 | case OP_IS_FLOOR: 563 | if ( ret_internal ) 564 | ret_str = "floor"; 565 | else 566 | ret_str = "Floor"; 567 | 568 | case OP_IS_CEIL: 569 | if ( ret_internal ) 570 | ret_str = "ceil"; 571 | else 572 | ret_str = "Ceiling"; 573 | 574 | // Do NOT have a default: here. Haxe compiler will then complain about missing cases. Nice! 575 | } 576 | 577 | /* COMMENTED OUT. As long as there is no default: for switch above. 578 | if ( 0 == ret_str.length ) 579 | { 580 | msg( "\n INTERNAL ERROR: Invalid op_meaning given \n" ); 581 | ret_str = "INTERNAL ERROR: Invalid op_meaning"; 582 | } 583 | */ 584 | 585 | return ret_str; 586 | } 587 | 588 | 589 | // Helper to give a readable string for a Return value number 590 | // 591 | public static function returnMeanAsStr( ret_meaning : ReturnMeanings ) : String8 592 | { 593 | comment( "Helper to give a readable string for a Return value number" ); 594 | var ret_str = ""; 595 | 596 | switch ( ret_meaning ) 597 | { 598 | // ERRORS about runtime code Defects 599 | case RET_IS_INTERNAL_ERROR: 600 | ret_str = "INTERNAL ERROR found"; 601 | case RET_IS_NOT_IMPLEMENTED: 602 | ret_str = "INTERNAL ERROR: is NOT IMPLEMENTED"; 603 | 604 | // ERRORS using runtime services 605 | case RET_FILE_PATH_NOT_FOUND: 606 | ret_str = "ERROR: File path not found"; 607 | case RET_FILE_NOT_FOUND: 608 | ret_str = "ERROR: File not found"; 609 | 610 | // ERRORS about User code 611 | case RET_IS_USER_ERROR_LOGICAL: 612 | ret_str = "User code has a Logical error"; 613 | case RET_IS_USER_ERROR_SYNTAX: 614 | ret_str = "User code has a Syntax error"; 615 | case RET_IS_USER_ERROR_DATA: 616 | ret_str = "Data type or value given is not appropriate"; 617 | case RET_IS_USER_ERROR: 618 | ret_str = "User code has an error"; 619 | 620 | // STOP 621 | case RET_IS_USER_ESC: 622 | ret_str = "User wanted to Stop"; 623 | // OK 624 | case RET_IS_OK: 625 | ret_str = "OK, normal result"; 626 | 627 | // STATUS giving a little detail 628 | case RET_IS_NEEDS_DATA: 629 | ret_str = "Not enough Data now, trying next words"; 630 | case RET_IS_NEEDS_NOUN: 631 | ret_str = "Not enough Nouns now, trying next words"; 632 | case RET_IS_NEEDS_PUNCTUATION: 633 | ret_str = "No punctuation yet, trying next words"; 634 | } 635 | 636 | return ret_str; 637 | } 638 | 639 | } 640 | --------------------------------------------------------------------------------