GithubHelp home page GithubHelp logo

beefytech / beef Goto Github PK

View Code? Open in Web Editor NEW
2.4K 52.0 123.0 44.32 MB

Beef Programming Language

Home Page: http://www.beeflang.org

License: Other

C++ 47.13% CMake 0.24% Makefile 3.87% Shell 4.44% M4 0.55% HTML 0.98% CSS 0.01% Roff 0.02% C 15.26% Perl 1.68% Assembly 0.02% C# 0.02% Batchfile 0.12% Python 0.01% Beef 25.61% Awk 0.01% Objective-C 0.04%
programming-language compiler ide beef-language

beef's Introduction

GitHub release MIT licensed

Beef Programming Language

Beef is an open source performance-oriented compiled programming language which has been built hand-in-hand with its IDE environment. The syntax and many semantics are most directly derived from C#, while attempting to retain the C ideals of bare-metal explicitness and lack of runtime surprises, with some "modern" niceties inspired by languages such as Rust, Swift, and Go. See the Language Guide for more details.

Beef's primary design goal is to provide a fluid and pleasurable development experience for high-performance real-time applications such as video games, with low-level features that make it suitable for engine development, combined with high-level ergonomics suitable for game code development.

Beef allows for safely mixing different optimization levels on a per-type or per-method level, allowing for performance-critical code to be executed at maximum speed without affecting debuggability of the rest of the application.

Memory management in Beef is manual, and includes first-class support for custom allocators. Care has been taken to reduce the burden of manual memory management with language ergonomics and runtime safeties – Beef can detect memory leaks in real-time, and offers guaranteed protection against use-after-free and double-deletion errors. As with most safety features in Beef, these memory safeties can be turned off in release builds for maximum performance.

The Beef IDE supports productivity features such as autocomplete, fixits, reformatting, refactoring tools, type inspection, runtime code compilation (hot code swapping), and a built-in profiler. The IDE's general-purpose debugger is capable of debugging native applications written in any language, and is intended to be a fully-featured standalone debugger even for pure C/C++ developers who want an alternative to Visual Studio debugging.

Binaries and Documentation

Official website (beeflang.org)
Documentation
Stable Releases
Nightly Windows Release

IDE Screenshots

Screenshot

beef's People

Contributors

aharabada avatar apg360 avatar bfiete avatar blat-blatnik avatar booklordofthedings avatar bttelle avatar daafu avatar damianday avatar disarray2077 avatar einscott avatar flying-dude avatar fusioon avatar green-sky avatar hermansimensen avatar hiroko103 avatar hunterbridges avatar hydrogenc avatar jamesaorson avatar kallisto56 avatar laurarozier avatar m910q avatar marsej avatar miere43 avatar minegame159 avatar moneyl avatar pmysl avatar roguemacro avatar rzuckerm avatar sere3925sere avatar xposure avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beef's Issues

Failed to load project 'corlib'

Just installed the Beef IDE and created one of the samples, but get the following error message:

ERROR: Failed to load project 'corlib' from 'C:\Utilizadores\Pedro Silva\AppData\Local\BeefLang\BeefLibs\corlib\BeefProj.toml'

The correct folder name would be (without the space in the username PedroSilva):

C:\Utilizadores\PedroSilva\AppData\Local\BeefLang\BeefLibs\corlib\BeefProj.toml

Unable to assign to static readonly value in constructor

Test2 works as expected.
Test1 is with the static modifier and won't let me assign to the variable _list.

        public class Test2
	{
		private readonly int[] _list;

		this()
		{
		    _list = new int[10];
		}
	}

	public static class Test1
	{
	    private static readonly int[] _list;

	    static this()
	    {
	        _list = new int[10];
	    }
	}

Unable to build IDEHelper

While running the build.sh script I came across an error once it hits the IDEHelper build
the extern directory is not in the IDEHelper directory but in the root directory of the compiler(Beef-0.42.1)
Starting build.sh
-- Configuring done
-- Generating done
-- Build files have been written to: /home/developer/devprojects/Beef-0.42.1/jbuild_d
[ 5%] Built target hunspell
[ 74%] Built target BeefySysLib
[ 92%] Built target IDEHelper
[ 93%] Built target BeefBoot
[100%] Built target BeefRT
-- Configuring done
-- Generating done
-- Build files have been written to: /home/developer/devprojects/Beef-0.42.1/jbuild
[ 75%] Built target hunspell
[ 75%] Built target BeefySysLib
[ 75%] Building CXX object IDEHelper/CMakeFiles/IDEHelper.dir/BfDiff.cpp.o
In file included from /home/developer/devprojects/Beef-0.42.1/IDEHelper/../extern/llvm-project_8_0_0/llvm/include/llvm/Support/AlignOf.h:17:0,
from /home/developer/devprojects/Beef-0.42.1/IDEHelper/../extern/llvm-project_8_0_0/llvm/include/llvm/ADT/SmallVector.h:18,
from /home/developer/devprojects/Beef-0.42.1/IDEHelper/Beef/BfCommon.h:18,
from /home/developer/devprojects/Beef-0.42.1/IDEHelper/BfDiff.cpp:11:
/home/developer/devprojects/Beef-0.42.1/IDEHelper/../extern/llvm-project_8_0_0/llvm/include/llvm/Support/Compiler.h:18:10: fatal error: llvm/Config/llvm-config.h: No such file or directory
#include "llvm/Config/llvm-config.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
IDEHelper/CMakeFiles/IDEHelper.dir/build.make:62: recipe for target 'IDEHelper/CMakeFiles/IDEHelper.dir/BfDiff.cpp.o' failed
make[2]: *** [IDEHelper/CMakeFiles/IDEHelper.dir/BfDiff.cpp.o] Error 1
CMakeFiles/Makefile2:196: recipe for target 'IDEHelper/CMakeFiles/IDEHelper.dir/all' failed
make[1]: *** [IDEHelper/CMakeFiles/IDEHelper.dir/all] Error 2

Missing StartsWith(char8 c)

We have 'public bool EndsWith(char8 c)' but not StartsWith(char8 c).
Oops should of mentioned in the String class :)

[Feature request] Allow using spaces instead of tabs

The IDE seems to be hardcoded to write tab characters instead of spaces when indenting code.

Please add an IDE option for using space characters ( ) for indentation and an option for how many characters wide the indentation should be.

[Feature Request] INumeric interface

I would like to create a templated type which can be any numerical type, but at the moment I have to choose either IIntegral or IFloating, it would be useful to have a INumeric which combines the two.

IOpNegatable: Cannot perform binary operation '-'

The full error is:
ERROR: Cannot perform binary operation '-' between two instances of type 'T'.
Some sample code to demonstrate the problem. I understand IOpNegatable only takes 1 parameter.

	public struct MyRect<T> where T : IOpNegatable,
	{
		private T x;
		private T y;
		private T width;
		private T height;

		public static MyRect<T> fromTLBR(T top, T left, T bottom, T right)
		{
			return MyRect<T>(left, top, (right - left), (bottom - top));
		}

		public this(T x, T y, T width, T height)
		{
			this.x = x;
			this.y = y;
			this.width = width;
			this.height = height;
		}
	}

To remedy this I changed the interface to similar to IOpAddable:

	interface IOpNegatable2
	{
		static Self operator-(Self lhs, Self rhs);
	}

Wrong constructor called during Test

using System;
using System.Diagnostics;

namespace Buffer
{
	class CircularBuffer
	{
		private const int DefaultSize = (1024 * 2);

		public uint8[] _data;

		public this(int size = DefaultSize)
			: base ()
		{
			Debug.Assert(size > 0);
			_data = new uint8[size];
		}
	
		[Test]
		public static void TestBuffer()
		{
			var buffer = new CircularBuffer();
			Debug.Assert(buffer._data.Count == CircularBuffer.DefaultSize);
		}
	}
}

Running the above test in debug mode seg faults _data is not allocated, only seems to happen during testing.

Project name and logo can hurt people's sensibilities

Hi! Thank you for releasing this project. I'm often looking for a language that is powerful and fast to compile that helps with experimentation :)

This issue may sound like a joke but it's not. I find it uncomfortable to look at a logo representing a sliced dead animal. Growing large animals for human consumption is also a contributor to the climate problem. I guess so far I'm part of a small but growing minority, but I thought I should still raise awareness to this. I know changing a name is a hard issue to fix.

Maybe Beef could be an acronym of something less bloody and the logo match that acronym?

Or if the authors are strong believers in raising animals for human consumption an option would be to fork the project and replace every mention of Beef with another word to appeal to a wider audience? Leaf sounds similar and has the same number of characters, but leaf-lang exists already.

In any case thank you for considering this.

[linux, xubuntu] Failed to compile

I git clone a repo and run a bin/build.sh. At the end i have 2 errors returned :
image

/usr/bin/ld: cannot find -ltinfo
collect2: error: ld returned 1 exit status
make[2]: *** [BeefBoot/CMakeFiles/BeefBoot.dir/build.make:173: Debug/bin/BeefBoot] Error 1
make[1]: *** [CMakeFiles/Makefile2:259: BeefBoot/CMakeFiles/BeefBoot.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

If you need more info, ask me

Cannot invoke private constructor from another constructor

In the following program public constructor cannot invoke private constructor, failing to compile with error Too many arguments, expected 1 fewer. But if private this is replaced with protected this the program compiles without problem.

namespace Issue
{
	public class Program
	{
		public static int Main(String[] args)
		{
			return 0;
		}

		public this()
			: this(0)
		{
		}

		private this(int i)
		{
		}
	}
}

Windows: broken system PATH after installation

  • Verify PATH is working by running cmd and typing where - there is where.exe output from %SystemRoot%\System32 executable
  • Install Beef and run cmd again - now where is not recognized as an internal ....
  • Delete Beef portion from system PATH with system enviroment variables editor and where is back in next cmd launch

Unexpected error for nullable parameters having types qualified with namespace

The program below gives the following error, which only happens if:

  1. both F1 and F2 are defined and both have nullable parameters,
  2. type of parameter of F2 is qualified with the namespace (type of
    parameter F1 could also be just int?).
ERROR: User-defined conversion must convert to or from the enclosing type
  while specializing type 'int?' at line 79:53 in .../BeefLibs/corlib/src/Nullable.bf
        public static implicit operator Nullable<T>(T value)
                                                    ^
Errors: 1.
Compile failed.
using System;

namespace Issue
{
	public typealias I = int;

	public class Program
	{
		public static int Main(String[] args)
		{
			return 0;
		}

		public static void F1(Issue.I? i) {};
		public static void F2(Issue.I? i) {};

		public void M(I i)
		{
			F1(i);
		}
	}
}

Unable to build the IDE

I tried to build the IDE and it failed.
(Git clone, open the relevant workspace, F7)

Is it ready for other people to try and do it themselves ?

Unable to build, for multiple reasons

  1. The website says that "Microsoft C++ build tools for Visual Studio 2013 or later." are needed, however this line requires "Visual Studio 15 2017 Win64". I went through this point by removing the part talking about "Visual Studio 15 2017 Win64" from that line.
  2. I was later asked for some specific version of the windows SDK (10.0.17763.0 instead of the 10.0.18362 that I had), and I didn't know why. I installed it.
  3. Now I have a lot of

c:\beef-master\idehelper\beef\bfcommon.h(18): fatal error C1083: Impossible d'ouvrir le fichier include : 'llvm/ADT/SmallVector.h' : No such file or directory [C:\Beef-master\Debugger64\Debugger64.vcxproj]

(unable to open "llvm/ADT/SmallVector.h" because it's not "there".) It exists a SmallVector.h in C:\Beef-master\llvm-project_8_0_1\llvm\include\llvm\ADT though.

So for these reasons I am unable to check my fix to #13 (comment)

build failed in macos

Building BeefBuild_bootd
[******************************]
TIMING: Beef compiling: 14.3s
WARNING: Enum value '2' for field 'Default' is not unique. Considering adding [AllowDuplicates] to the type declaration. Line 175:3 in /Users/jack/src/beef/Beef/BeefLibs/corlib/src/FFI/Function.bf
Default = Unix64

This value was previously used for field 'Unix64' at line 174:3 in /Users/jack/src/beef/Beef/BeefLibs/corlib/src/FFI/Function.bf
Unix64,
Errors: 0. Warnings: 1.
Linking BeefBuild_bootd...Undefined symbols for architecture x86_64:
"_ffi_call", referenced from:
bf::System::FFI::FFILIB::Call(bf::System::FFI::FFILIB::FFICIF*, void*, void*, void**) in libBeefRT_d.a(Internal.cpp.o)
"_ffi_closure_alloc", referenced from:
bf::System::FFI::FFILIB::ClosureAlloc(long, void**) in libBeefRT_d.a(Internal.cpp.o)
"_ffi_prep_cif", referenced from:
bf::System::FFI::FFILIB::PrepCif(bf::System::FFI::FFILIB::FFICIF*, bf::System::FFI::FFIABI, int, bf::System::FFI::FFIType*, bf::System::FFI::FFIType**) in libBeefRT_d.a(Internal.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
FAIL: Exit code returned: 1

FAILED

Windows: IDE is not DPI aware

It is declared as DPI-aware but no actual DPI aware support present => extremely small text size on hi-dpi screens

Build failed on Linux (Fedora 31)

libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -I. -I../include -Iinclude -I../src -MT src/x86/sysv.lo -MD -MP -MF src/x86/.deps/sysv.Tpo -c ../src/x86/sysv.S -fPIC -DPIC -o src/x86/.libs/sysv.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -I. -I../include -Iinclude -I../src -MT src/x86/sysv.lo -MD -MP -MF src/x86/.deps/sysv.Tpo -c ../src/x86/sysv.S -o src/x86/sysv.o >/dev/null 2>&1
/bin/sh ./libtool --tag=CC --mode=link gcc -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -march=core2 -Wall -fexceptions -o libffi_convenience.la src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffi.lo src/x86/sysv.lo
libtool: link: ar cru .libs/libffi_convenience.a src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/x86/.libs/ffi64.o src/x86/.libs/unix64.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o
libtool: link: ranlib .libs/libffi_convenience.a
libtool: link: ( cd ".libs" && rm -f "libffi_convenience.la" && ln -s "../libffi_convenience.la" "libffi_convenience.la" )
/bin/sh ./libtool --tag=CC --mode=link gcc -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -march=core2 -Wall -fexceptions -no-undefined -version-info grep -v '^#' ../libtool-version -o libffi.la -rpath /usr/local/lib/../lib64 src/prep_cif.lo src/types.lo src/raw_api.lo src/java_raw_api.lo src/closures.lo src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffi.lo src/x86/sysv.lo
libtool: link: gcc -shared -fPIC -DPIC src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/x86/.libs/ffi64.o src/x86/.libs/unix64.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o -O3 -march=core2 -Wl,-soname -Wl,libffi.so.6 -o .libs/libffi.so.6.0.1
libtool: link: (cd ".libs" && rm -f "libffi.so.6" && ln -s "libffi.so.6.0.1" "libffi.so.6")
libtool: link: (cd ".libs" && rm -f "libffi.so" && ln -s "libffi.so.6.0.1" "libffi.so")
libtool: link: ar cru .libs/libffi.a src/prep_cif.o src/types.o src/raw_api.o src/java_raw_api.o src/closures.o src/x86/ffi64.o src/x86/unix64.o src/x86/ffi.o src/x86/sysv.o
libtool: link: ranlib .libs/libffi.a
libtool: link: ( cd ".libs" && rm -f "libffi.la" && ln -s "../libffi.la" "libffi.la" )
make[3]: Leaving directory '/home/michal/Playground/Beef/BeefySysLib/third_party/libffi/x86_64-unknown-linux-gnu'
make[2]: Leaving directory '/home/michal/Playground/Beef/BeefySysLib/third_party/libffi/x86_64-unknown-linux-gnu'
make[1]: Leaving directory '/home/michal/Playground/Beef/BeefySysLib/third_party/libffi/x86_64-unknown-linux-gnu'
Building LLVM...
build.sh: line 22: cd: ../extern: No such file or directory

Formatting error

public abstract class ImageLoader
{
}

Reformat document with the above class and the public abstract becomes publicabstract one word.

Syntax highlighting for 'this'

Not a big deal, just used to it being highlighted in visual studio.
'this.' is not highlighted yet 'this' without the dot is highlighted.

Hello World/IDE Crashes with Test -> Run -> Normal Test

I downloaded release 0.42, installed the binaries on windows 10. Started the IDE and picked the Hello World example which loaded into the IDE window. I selected build F7, and build was successful. Ctrl F5 to run, worked great. However playing around I noticed that if I selected Test -> Run -> Normal Tests the IDE crashed with the following dump:

Crash minidump saved as C:\Program Files\BeefLang\bin\CrashDumps\BeefIDE_20200113_200332.dmp

Exception: Access Violation (code 0xc0000005) at address 7ff7'b9741e38 in thread 40FC
Executable: C:\Program Files\BeefLang\bin\BeefIDE.exe
File Version: 0.42
Product Version: c2ee401

Logical Address: 0001:'001d0e38

c2'809fefb0 7ff7'b9741e38 0001:'001d0e38 BeefIDE.exe
Params: '00000000 7ff7'b977d0b4 28c'e01a3850 576e9952'4d52a49e

c2'809feff0 7ff7'b9741f67 0001:'001d0f67 BeefIDE.exe
Params: 28c'cdee0000 7ffd'd2b0922b '00000040 '00000004

c2'809ff960 7ff7'b9619bbc 0001:'000a8bbc BeefIDE.exe
Params: '00000000 '00000000 '00000000 '00000002

c2'809ff9a0 7ff7'b9767410 0001:'001f6410 BeefIDE.exe
Params: '00000000 '00000000 '00000000 '0000060c

c2'809ff9d0 7ffd'94783dcd Beef042RT64.dll unsigned long bf::System::Threading::Thread::GetProcessDefaultStackSize(void)+9D
Params: 28c'df687ef0 '00000000 '00000000 '00000000

c2'809ffa00 7ffd'd0c84034 KERNEL32.DLL BaseThreadInitThunk+14
Params: '00000000 '00000000 '00000000 '00000000

c2'809ffa50 7ffd'd2b63691 ntdll.dll RtlUserThreadStart+21
Params: '00000000 '00000000 '00000000 '00000000

RAX:4c'00000012 RBX:'00000000 RCX:4c'00000012 RDX:'00000000 RSI:28c'de715ca8 RDI:4c'00000012
R8:28c'de715ca8 R9:7ff7'b95701ff R10:'00000100 R11:28c'e01a3860
R12:'00000000 R13:7ff7'b9786758 R14:c2'809fefe8 R15:'0000000a
EIP:7ff7'b9741e38 ESP:c2'809fef50 EBP:'00000000
CS:0033 SS:002B DS:002B ES:002B FS:0053 GS:002B
Flags:'00010246

Fatal error: Failure during codegen

Attached crash dump below
crash.zip

Happens when I run the Normal Test, the culprit is when I changed msg from'var' to 'let' in 'TestTagCount', otherwise compiles successfully.

                using System;

                public static int TagCount(StringView source, char32 value)
		{
			var count = 0;
			if (source.IsEmpty == false)
			{
				for (var ch in source)
					if (ch == value)
						count++;
			}
			return count;
		}

                [Test]
		public static void TestTagCount()
		{
		    let msg = "message";

		    Test.Assert(2 == Utility.TagCount(msg, 'e'));
		    Test.Assert(1 == Utility.TagCount(msg, 'a'));
		}

SpaceGame sample project doesn't start after building in Release mode

Beef IDE 0.42 c2ee4018
Settings Properties Visual Studio Tool Path (x64): C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64

Steps to reproduce (current workspace: SpaceGame, current Startup Project: SpaceGame):

  • Switch to Win64 Release
  • Build -> Clean, Build -> Clean Beef
  • Build -> Build Solution
output
Compiling...
Beef compilation time: 2.92s
500 modules built, 500 object files generated
Executing Command: CopyToDependents("$(ProjectDir)/dist/*.dll")
Command Time: 0.04s
Executing: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\Hostx64\\x64/link.exe" @C:\Users\michal\AppData\Local\Temp\tmp5AE1.tmp
Beef042RT64_ss.lib(Math.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(Math.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(Internal.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(Internal.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(Platform.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(Platform.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(Thread.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(Thread.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(closures.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(closures.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(prep_cif.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(prep_cif.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(ffi.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(ffi.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(Common.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(Common.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(String.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(String.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(CrashCatcher.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(CrashCatcher.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Beef042RT64_ss.lib(UTF8.obj) : warning LNK4099: PDB 'BeefRT.pdb' was not found with 'Beef042RT64_ss.lib(UTF8.obj)' or at 'c:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\BeefRT.pdb'; linking object as if no debug info
Execution time: 0.49s
Total build time: 3.50s
  • Run C:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame
  • Fatal Error! An unexpected error has occured!
text output in error message window
FATAL ERROR
Unhandled error in result

Exception: Breakpoint (code 0x80000003) at address 7ff7'e90c0a8b in thread 578
Executable: C:\Program Files\BeefLang\Samples\SpaceGame\build\Release_Win64\SpaceGame\SpaceGame.exe

Logical Address: 0001:'0000fa8b

c5'35d8f770 7ff7'e90c0a8b SpaceGame.exe void Beefy::CrashCatcher::Crash(class Beefy::StringImpl const & __ptr64)+5B
    Params: 251'815f2070 '0000000b '0000000b c5'35d8f859

c5'35d8f820 7ff7'e90be637 SpaceGame.exe BfpSystem_FatalError+157
    Params: '00000001 '00000000 '00000000 c5'35d8f8a0

c5'35d8f850 7ff7'e90b9d5f SpaceGame.exe System.Result<void>.ReturnValueDiscarded+1F
    at c:\Program Files\BeefLang\BeefLibs\corlib\src\Result.bf:82
    Params: '00000002 '00000038 '00000001 251'8156a1a0

c5'35d8f8c0 7ff7'e90b3943 SpaceGame.exe SpaceGame.GameApp.Init+23
    at c:\Program Files\BeefLang\Samples\SpaceGame\src\GameApp.bf:45
    Params: '00000000 251'8156aaa0 '00000028 7ff7'e90c35bf

c5'35d8f970 7ff7'e90b4ce1 SpaceGame.exe SpaceGame.Program.Main+31
    at c:\Program Files\BeefLang\Samples\SpaceGame\src\Program.bf:21
    Params: 251'8156aaa0 251'815788c0 80000000'00000001 7fffffff'ffffffff

c5'35d8f9a0 7ff7'e90bd549 SpaceGame.exe BeefStartProgram+9
    Params: 251'8156aaa0 '00000000 '00000001 7ff7'e90df588

c5'35d8f9d0 7ff7'e90bd52c SpaceGame.exe WinMain+7C
    Params: '00000001 '00000000 '00000000 '00000000

c5'35d8fa10 7ff7'e90c32be SpaceGame.exe __scrt_common_main_seh+106
    at d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    Params: '00000000 '00000000 '00000000 '00000000

c5'35d8fa40 7ffe'aa4a7bd4 KERNEL32.DLL BaseThreadInitThunk+14
    Params: '00000000 '00000000 '00000000 '00000000

c5'35d8fac0 7ffe'abe2ced1 ntdll.dll RtlUserThreadStart+21
    Params: '00000000 '00000000 '00000000 '00000000


RAX:'00000000 RBX:c5'35d8f7d0 RCX:'ffffffff RDX:7ff7'e9127890 RSI:'0000000b RDI:7ff7'e9127420
R8:'00000000 R9:7ff7'e90b0000 R10:7ff7'e9127890 R11:251'815f1b90
R12:'00000000 R13:'00000000 R14:'0000000c R15:7ff7'e9113290
EIP:7ff7'e90c0a8b ESP:c5'35d8f750 EBP:c5'35d8f800
CS:0033 SS:002B DS:002B ES:002B FS:0053 GS:002B
Flags:'00200202

I have a recent Windows 10 version (1909 build 18363.535) and just installed the Visual Studio Build Tools 2019 after getting prompted to do so during Beef installation. During installation I checked C++ build tools, and inside them I additionally checked C++ Clang Tools because I thought they may be needed.

IDE and compiler unable to handle recursive enums, even to display an error.

Recursive enum cases currently cause both the IDE and beefbuild to crash, which, in addition to making it impossible to implement something like an arithmetic expression tree, makes it difficult to implement any other kind of tree structure which might refer to itself in some way, such as a JSON value (at least in the IDE's case)

This crashes both the IDE and the compiler without fail:

enum Expression
{
    case Number( double x );
    case Add( Expression left, Expression right );
    // other arithmetic operations
}

And this will crash just the IDE when typed out normally:

enum JsonValue
{
    case Null;
    case Array( JsonValue[] items );
}

The IDE crashes just after inserting JsonValue when declaring the Array case before even being able to insert the square brackets, requiring some other external editor, but otherwise it works as expected once that's sorted out.

I'm assuming naked recursion (such as in example 1) without putting the Self behind a pointer, array, or some other form of indirection is intended since doing the same thing with a struct correctly produces an error without crashing.

As an aside, what is the idiomatic way of writing the first snippet properly? Pointer? Some kind of Box<T> like Rust?

Unable to compile the simplest program

Hi,

I was trying to create the simplest console program and I get the following error:

Compiling...
Beef compilation time: 0.06s
ERROR: Unable to find entry point class 'Program' in project 'test_2'
0 modules built, 0 object files generated
Errors: 1.
Compile failed.
Changes not saved.
Workspace closed.

The after closing and restarting the project (and then the entire IDE) I get the following error:

ERROR: Project 'test_2' is not loaded. Retry loading by right clicking on the project in the Workspace panel and selecting 'Retry Load'

Crash when changing font to non-existent file

In my first effort to change the font I replaced fonts/SourceCodePro-Regular.ttf with fonts/Consolas.ttf which popped up a very nasty crash whose UI was frozen (I couldn't scroll or see core dump either).
image

I managed to change font by simply having the word Consolas instead of fonts/Consolas.ttf (duh)

Windows: uninstaller missing

It does not appear in installed programs list and BeefUninstall.exe do nothing.
But it adds system variables and modify PATH when installed, I suspect after installation my PATH was broken until I restore it by hand

Returning errors from constructors

Since Exceptions are not available:

  • how do I report an error from a constructor?
  • how do I know if a constructor executed successfully?

For example, I looked into your DateTime implementation and constructors with out of range parameters call Runtime.FatalError(), which is not recoverable.

LLVM codegen issue on Linux

Trying to get a sense of how much work is involved in getting the IDE GUI to run on Linux. I hacked out all the compile errors, but I then get an LLVM error when I try to build. Steps to reproduce:

  • Check out https://github.com/gw3583/Beef/tree/ide-hack on Linux (has the compile errors hacked out + the linux build script improvements).
  • Build via bin/build.sh
  • Manually run ./IDE/dist/BeefBuild -proddir=IDE -clean -config=Debug_NoDeps

The output I get is:

[*****************Call parameter type does not match function signature!
i8* %0
 i32  %4 = call i32 @BfpSystem_SetCommandLine(i8* %0, i8* %1)
in function WinMain
LLVM ERROR: Broken function found, compilation aborted!

Compiler segfault on allocation of array of empty struct

The following program segfaults compiler (it triggers assertion irValue.mId >= 0 in BfIRBuilder.cpp line 1704 when runnig BeefBuild_d at commit 2b0f7fb). When replacing scope S[1] with scope S[0] another assertion is triggered.

using System;

namespace Issue
{
	public class Program
	{
		public static int Main(String[] args)
		{
			scope S[1];
			return 0;
		}
	}

	struct S
	{
	}
}

GetHashCode unaccessible on primitive type

GetHashCode is declared private in primitive types.

        public class Vector2 : IHashable
	{
		public int GetHashCode()
		{
		    return X.GetHashCode() ^ Y.GetHashCode();
		}

		public float X;
		public float Y;
	}

Cannot pass regular parameters as ref

static void SomeRef(ref int i) { }

static void NoRef(int i)
{
SomeRef(ref i);
}

"Cannot use 'ref' on parameter 'i'. Consider adding 'ref' specifier to parameter or copying to a local variable"

This is valid syntax in C#, probably the parameter is shadowed on stack if not already passed on stack.


Later edit: Later I saw that this is a direct consequence of the fact that value parameters cannot be used inside a function:

void SomeFunc(int i) { i = 0; } //=> error.

Socket class support for linux

I suppose Socket class supports only windows as of now, support of linux is much appreciated.
Also it seems that we are linking to Clib function which are windows only for linux (like closesocket).

Failed build on Linux Mint

Scanning dependencies of target llvm-lto
[ 87%] Building CXX object tools/llvm-lto/CMakeFiles/llvm-lto.dir/llvm-lto.cpp.o
[ 87%] Linking CXX executable ../../bin/llvm-lto
collect2: fatal error: ld terminated with signal 9 [Ucciso]
compilation terminated.
tools/llvm-lto/CMakeFiles/llvm-lto.dir/build.make:254: recipe for target 'bin/llvm-lto' failed
make[2]: *** [bin/llvm-lto] Error 1
make[2]: *** Eliminazione del file "bin/llvm-lto"
CMakeFiles/Makefile2:21697: recipe for target 'tools/llvm-lto/CMakeFiles/llvm-lto.dir/all' failed
make[1]: *** [tools/llvm-lto/CMakeFiles/llvm-lto.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

Sadly Linux build didn't work, I'm using Linux Mint 19.3.

Does anyone have some clues? Also the building process was very slow (some hours), is this usual?

Compiler segfault on generic method with delegate as argument

In the following program the compiler segfaults in
BfModule::GetGenericParamInstance on dereferencing mMethodInfoEx
which is null. The problem is in the line marked with // issue and
there is no problem in the previous line which uses delegate stored
in a local variable.

(It would be nice feature if compiler could determine generic argument T
from the delegate to omit explicit <String>).

using System;

namespace Issue
{
	class Program
	{
		public static int Main(String[] args)
		{
			var p = scope Program();
			delegate void(String v) dlg = scope => p.Method;
			p.Generic<String>(dlg);
			p.Generic<String>(scope => p.Method); // issue
			return 0;
		}

		public void Generic<T>(delegate void(T v) dlg)
		{
		}

		public void Method(String v)
		{
		}
	}
}

Missing namespace in StartupObject property

When you create a new project in the workspace, the default value of Startup Object is Program, no namespace. But when you create a class in the IDE, named Program, it will be placed in the default namespace. I think the default value of Startup Object should including namespace.

Error loading project

OS: Win 7 Pro SP 1

ERROR: Failed to load project 'Utility' from 'C:\Users\Damian Day\OneDrive\Programming\Beef\Utility\BeefProj.toml'

Actual location
C:\Users\dday.EPWGRP\OneDrive\Programming\Beef\Utility\BeefProj.toml

Also fails to load any linked project libraries.
Loading project on a networked station, dont have any problem loading on home PC.

Ambiguity between null conditional member access and conditional

return hasErrors ?.Err :.Ok; // equivalent to "if (hasErrors) return .Err else return .Ok

In the case above ?. is considered a single operator instead of two. This can be avoided by putting a space between ? and ., but since hasError is not a nullable, my expectation was that the compiler will figure it out.

Typo in DeleteDictiony..

DeleteDictionyAndKeysAndItems
DeleteDictionyAndKeys
Are probably a typo for DeleteDictionary..

IDE save the file in wrong path.

It seems the IDE cannot handle the Users folder in windows 10.
I save my workspace in:
image
The real path should be:
C:\Users\Domain\source\repos\Beef\zero
But when I save the workspace, the file is placed in:
C:\用户\Domain\source\repos\Beef\zero
i.e. the Users folder become '用户' in Chinese.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.