Commit graph

10 commits

Author SHA1 Message Date
Mau Magnaguagno
ace41c556a
[YARP] Avoid if-else in yp_compile_node (#8336)
Move last node case outside for loop.
2023-08-31 10:00:19 -07:00
Jemma Issroff
b90457b210
[YARP] Implement SourceNodes (File, Line, Encoding) (#8328)
* [YARP] Implement SourceNodes (File, Line, Encoding)
2023-08-31 09:56:13 -07:00
Jemma Issroff
36786cc381
[YARP] Compile ProgramNode as ScopeNode (#8327)
* [YARP] Compile ProgramNode as ScopeNode
2023-08-30 14:30:42 -07:00
Jemma Issroff
0ec5021f3d
[YARP] Implement BreakNode, NextNode, RedoNode (#8334) 2023-08-30 14:27:08 -07:00
Jemma Issroff
f1790fa4e7
[YARP] Fix variables in compilation (#8326)
* [YARP] Fixed several popped instructions

* [YARP] Correctly compiling class path
2023-08-30 14:26:22 -07:00
Kevin Newton
49dff732e8
Update YARP APIs to handle uint8_t 2023-08-30 14:41:39 -04:00
Jemma Issroff
3151d7876f
[YARP] Until Node, minor cleanup (#8325)
* Remove conditional from yp_compile_if

* Extracted yp_compile_while, compile UntilNode

* Small checks for body / value that could be empty
2023-08-29 14:17:08 -07:00
Jemma Issroff
80dc570a45
Compile more YARP node types (#8322)
* Add several more node simple types to YARP's compiler:

Nodes include: DefinedNode, EmbeddedStatementsNode,
LocalVariableReadNode, LocalVariableWriteNode, MultiWriteNode,
OptionalParameterNode, SplatNode, YieldNode

* Add AssocSplatNode, RangeNode

* Add RangeNode, other helpers for future nodes

* Add ArrayNode, HashNode, static literal helpers

* Add branch conditionals

* Add IfNode, UnlessNode

* Add ScopeNode

* NEW_ISEQ and NEW_CHILD_ISEQ implemented for YARP

* Add nodes that depend on ScopeNode

* Addressed PR comments
2023-08-29 13:13:15 -07:00
Jemma Issroff
535045ab3b
[YARP] Compile basic types (#8311)
* Add a compile_context arg to yp_compile_node

The compile_context will allow us to pass around the parser, and
the constants and lookup table (to be used in future commits).

* Compile yp_program_node_t and yp_statements_node_t

Add the compilation for program and statements node so that we can
successfully compile an empty program with YARP.

* Helper functions for parsing numbers, strings, and symbols

* Compile basic numeric / boolean node types in YARP

* Compile StringNode and SymbolNodes in YARP

* Compile several basic node types in YARP

* Added error return for missing node
2023-08-29 09:27:00 -07:00
Jemma Issroff
3b815ed7da
Add yarp/yarp_compiler.c (#8042)
* Add yarp/yarp_compiler.c as stencil for compiling YARP

This commit adds yarp/yarp_compiler.c, and changes the sync script
to ensure that yarp/yarp_compiler.c will not get overwritten

* [Misc #119772] Create and expose RubyVM::InstructionSequence.compile_yarp

This commit creates the stencil for a compile_yarp function, which
we will continue to fill out. It allows us to check the output
of compiled YARP code against compiled code without using YARP.
2023-08-28 13:55:58 -07:00