Giter VIP home page Giter VIP logo

vongsprache's Introduction

Vongsprache

I bims 1s Sprache vong Programmierigkeit her!

Die Vongsprache ist jetzt auch eine Programmiersprache. In SYNTAX.md stehen mehr Details apropos die Regeln der Sprache und eingebildete Funktionen. In INTERNALS.md stehen Details über die innere Arbeitsweisen der Sprache.

Im examples-Verzeichnis stehen schon geschriebene Skripten zur Verfügung. Diese sind Beispielsskripten und zeigen einige Funktionen der Sprache.

Kompilation

Um den Vongsprache-Interpreter zu kompilieren, soll die enthaltene Makefile genutzt werden. Objektcode wird im obj-Verzeichnis gehalten.

Benutzung

Vongsprache Skripten enden mit .vong. Um eins zu interpretieren, soll es als Argument zum Interpreter gegeben werden.

vongsprache meinSkript.vong

Programmbibliotheke

Neben dem Quellcode stehen auch ein paar Programmbibliotheke im vonglib-Verzeichnis zur Verfügung. Diese Skripten enthalten verschiedene Funktionen. Diese werden in LIBRARIES.md erklärt.

Lizenz

Projekt unter MIT Lizenz verfügbar.

vongsprache's People

Contributors

arc676 avatar fatcat560 avatar ilevn avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ilevn fatcat560

vongsprache's Issues

Tokens created during evaluation not always destroyed

When evaluating blocks and loops, the evaluated values are assigned to the overall return value but intermediate values are not destroyed properly.

evaluation.c, line 254 as at commit 30376cd

returnValue = eval(statements[i], childScope);

This memory leak should be fixed.

Arrays

Implement an array type.

Built in functionality:

  • Array initialization
  • Array index access
  • Get array length
  • Adding elements to array
  • Removing elements from array

Library functions:

  • Bubble sort
  • Merge sort
  • Binary search
  • Linear search

Integer cast on print

Numerical values are stored as floating point values, but whenever a numerical value is printed, it should be cast to integer to avoid the unnecessary decimal places.

Project won't compile with current makefile

Trying to compile the freshly downloaded project yields a linker error

../obj/main.o: In function `applyOp':
main.c:(.text+0x37e): undefined reference to `fmod'
collect2: error: ld returned 1 exit status
Makefile:16: recipe for target 'vongsprache' failed
make: *** [vongsprache] Error 1

Adding -lm to the makefile fixed it for me

vongsprache: makedir $(_OBJS)
	$(CC) -o $(OUT) $(_OBJS) -lm

Loop control flow

Return statements have already been implemented, but the language also needs break and continue statements.

Escape sequences in strings

Add the ability to use escape sequences such as \n to allow printing of tabs and newlines at will.

Remove the empty printf call at the end of vongsprache_print.

Identifier memory corrupted in long loops

When running a for loop with a large number of iterations, it appears that the memory used to store the identifiers in the loop scope gets corrupted, resulting in segmentation faults during scope destruction.

This has been tested in a script whose evaluation would result in over 50 identifiers being added to the list, most of which were just durchmarsch CONTINUE indicators.

Improved interactive mode

Having to enter a parse mode in interactive mode is uncharacteristic of shells and interpreters. The parsing code should be updated to include a way to read not just until EOF but optionally until no data is given. This would allow the user to write code like in a Python interpreter.

This would also result in the need for builtin exit and help functions.

  • bidde beenden (possibly with a new name)
  • bidde was (needs an extensible design)
  • Stopping lexing at a double newline instead of just EOF
  • New termination method for errors that stops evaluation but doesn't terminate interpreter program
  • Count blocks opened and closed such that parsing can stop after a single line if no blocks were opened

Runtime error messages

The standard error message includes the line and column on which parsing failed. This is printed even for runtime issues, which makes no sense since the printed location is the EOF.

This should be updated to either print the source code at the location of the failure or otherwise show where the execution of the script failed.

RNG

Add a built in function for generating random numbers.

Negation operator

The language has binary operators but not unary operators. This means there's no logical NOT operator (currently implemented as a library function).

This should be implemented, as it will also pave the way for unary bitwise NOT.

String manipulation

The language needs to provide more access to strings and allow string manipulation.

Functions that should be added as built in functions:

  • Substrings
  • Get string length

Library functions:

  • Checking if a string starts or ends with a given string

File I/O

The language lacks the ability to interact with the filesystem.

This would require:

  • A way to represent FILE* objects
  • Builtin wrapper functions for fopen,
  • fclose,
  • fgets,
  • and fprintf

This could be optimized by repurposing the existing builtin print function to allow printing to any file and passing stdout for normal printing.

Compilation mode

Learning opportunity: add a compilation mode to Vongsprache, allowing the conversion of source files to binary executables.

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.