diff --git a/src/codegen.py b/src/codegen.py index 811ed6a..b71def6 100644 --- a/src/codegen.py +++ b/src/codegen.py @@ -69,7 +69,7 @@ def generateCode(line: list[str], offset: int) -> str: returnval = '>' * (offset + idx) + '[' + '<' * idx + '<+<+>>' + '>' * idx + '-]' returnval += '<' * idx + '<[->' + '>' * idx + '+' + '<' * idx + '<]<' - returnval += '[->>[>]' + returnval += '[[-]>>[>]' for var in variables: if var.bytes >= 0: returnval += '>' * (var.bytes+1) @@ -87,6 +87,7 @@ def generateCode(line: list[str], offset: int) -> str: error() returnval += '<[<]<]' returnval += '<' * (offset-2) + variables.append(Variable(line[1], 1, 0)) return returnval elif keyword == 'string': if len(line) != 4: diff --git a/syntax.md b/syntax.md index 86c1f27..5bd794e 100644 --- a/syntax.md +++ b/syntax.md @@ -6,6 +6,8 @@ Create a string: `string name value bytes` Create a boolean: `bool name value` +Create a boolean from input byte: `booli name byte` + Create an integer: `int name value` **Note**: A string of dynamic length can be created by setting the bytes to -1. diff --git a/tests/test.basm b/tests/test.basm index 20cebd6..5a995fb 100644 --- a/tests/test.basm +++ b/tests/test.basm @@ -1,13 +1,2 @@ -int num1 796 -string str1 -1 "Hello, world!" -int num2 795 -string str2 -1 "World, hello?" -equal num1 num2 cond -if cond - print str1 -end if -inc num2 -equal num1 num2 cond2 -if cond2 - print str2 -end if \ No newline at end of file +booli cond 1 +bool cond2 true \ No newline at end of file