项目作者: VsSekorin

项目描述 :
BiLogic programming language
高级语言: Java
项目地址: git://github.com/VsSekorin/BiLogic.git
创建时间: 2017-07-18T20:41:36Z
项目社区:https://github.com/VsSekorin/BiLogic

开源协议:MIT License

下载


BiLogic (BivalentLogic) is programming language (esoteric) for JVM. All variables are boolean.

Methods

  1. def name
  2. body
  3. end def
  1. <VarList> invoke name <Arguments>
  2. VarList := varname, <VarList> | _, <VarList> | varname | _
  3. Arguments := true <Arguments> | false <Arguments> |
  4. varname <Arguments> | true | false | varname

Main method:

  1. def main
  2. ...
  3. end def

Example

  1. def main
  2. res1, res2 invoke method1
  3. res3, _, res4, res5 invoke method2 false res1
  4. end def
  5. def method1
  6. in var1, var2
  7. ret var2
  8. var3 is var1 -> var2
  9. ret var3
  10. end def
  11. def method2 arg1 arg2
  12. ret arg1 and arg2
  13. ret arg1 or arg2
  14. ret arg1 xor arg2
  15. ret arg1 -> arg2
  16. end def

Assignment

Operations:

  • not
  • or
  • and
  • xor
  • ->
    1. Assignment := <VarList> is <Expression>
    2. Expression := true | false | varname | not <Expression>
    3. <Expression> <BOperation> <Expression>
    4. BOperation := and | or | xor | ->
    Examples:
    1. var is true
    1. var is false
    1. result is var1 and var2 or not var3
    1. var1, var2 is expression

Input

  1. Input := in <VarList>

Examples:

  1. in var
  1. in var1, var2, var3

Output

Start with out. Examples:

  1. out {var}
  1. out text
  1. out Value = {var}

And you can use expressions inside braces:

  1. out Result: {var1 or not var2 -> var3}. I hope.

If

  1. IfStatement :=
  2. if <Expression> then
  3. <Code>
  4. else
  5. <Code>
  6. end if

Example:

  1. if var1 and not var2 then
  2. var3, var4 is expression
  3. out Hmmm {var3}
  4. else
  5. out {var3}
  6. end if

While

  1. While :=
  2. while <Expression> do
  3. <Code>
  4. end while

Example:

  1. while var1 or var2
  2. out {var3}
  3. var4 is var5 or var6
  4. var2 is var6 -> var4
  5. end while

Exception

  1. panic
  1. panic Message

Comment

  1. -- Text

License (MIT)

MIT License

Copyright (c) 2017 Vseslav Sekorin (vssekorin.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.