mirror of
https://github.com/Noratrieb/GRSBPL.git
synced 2026-01-14 11:45:02 +01:00
Add files via upload
This commit is contained in:
parent
7917a81543
commit
3b28884385
3 changed files with 48 additions and 0 deletions
38
StackBasedLanguage/errors.md
Normal file
38
StackBasedLanguage/errors.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# All GRSBPL Error Messages
|
||||
|
||||
## Syntax Errors
|
||||
|
||||
- Any uncaught exception occurs during lexing:
|
||||
`Unknown Syntax Error. <exceptionname>: <exceptionmessage>`
|
||||
|
||||
- Invalid character escaped:
|
||||
`Invalid escape sequence <escaped>`
|
||||
|
||||
- Integer parse failed (can only happen because number is too big)
|
||||
`Value not an integer: <number>`
|
||||
|
||||
## Runtime Errors
|
||||
|
||||
- Label not found
|
||||
`Label '<name>' not found`
|
||||
|
||||
- Function not found
|
||||
`Function '<name>' not found`
|
||||
|
||||
- Stack empty on return
|
||||
`Function has to return some value, but no value was found on the stack`
|
||||
|
||||
- Pop called on empty stack
|
||||
`Cannot pop empty stack`
|
||||
|
||||
- No stack frame left after return
|
||||
`Tried to return outside of function, probably forgot to skip a function`
|
||||
|
||||
- Stackoverflow - limit 1 000 000
|
||||
`Stackoverflow. Limit of <STACK_LIMIT> stack frames reached.`
|
||||
|
||||
- Invalid token found
|
||||
`Excepted token '<name>' but found '<name>'`
|
||||
|
||||
- Failed to read input from stdin
|
||||
`[VM] - Error reading input`
|
||||
9
StackBasedLanguage/fizzbuzz.grsbpl
Normal file
9
StackBasedLanguage/fizzbuzz.grsbpl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
10 factorial 1 goto exit
|
||||
|
||||
function factorial 1
|
||||
dup not goto isZero
|
||||
pop dup 1 - factorial * return
|
||||
:isZero
|
||||
1 pop return
|
||||
|
||||
:exit pop dup nout
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
<properties>
|
||||
<maven.compiler.source>14</maven.compiler.source>
|
||||
<maven.compiler.target>14</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue