8000 GitHub - olus2000/Marn: A language that will hopefully be accepted as the project for the TKOM course
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

olus2000/Marn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Marn

A language that will hopefully be accepted as the project for the TKOM course. Clearly unfinished.

Important: This project will be developed on a hidden repo on WUT gitlab for now because of grading requirements. Whenever I have time I will try to update this repo with info from that other one, but they require a more rigid repo structure so I can't just copy this one. I could probably do it nicely with some git magic, but cant be bothered.

Usage

In the proj.py file there are two functions (for now):

lexeme_generator : TextIOStream, list -> Generator[Token] :
Consumes the text stream and returns a generator of tokens. Any lexing errors will be appended to the list.
parse_tokens : Generator[Token], list -> AST :
Consumes the generator and returns the AST without resolving names. All unresolved names are NameNode instances. Parsing errors are appended to the list. Unfinished.

There is also a temporary helper method test that takes a string and tries to parse it, returning an error list if any errors are encountered.

AST

The AST dataclass is probably what you're going to be most interested in at this point of the project. It holds four dictionaries: one for each of words, types, type aliases and type constructors. It also holds a list of all definitions and top level comments in the sequential field, still debating whether this is useful in any way.

Language sample

For now it doesn't execute anything yet, but if you input this implementation of fibonacci into test it should spit out the AST for it:

: fib ( n -- f(n) )
  0 1 rot match:
    case: Succ dip: over + swap ; ;
    case: Zero drop ; ;

About

A language that will hopefully be accepted as the project for the TKOM course

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0